vdr-1.5.3 - issue with translations out of plugins

Message ID 46728CFD.7000004@cadsoft.de
State New
Headers

Commit Message

Klaus Schmidinger June 15, 2007, 12:58 p.m. UTC
  On 06/13/07 12:50, Matthias Becker wrote:
> Hi everbody,
> 
> I also tried both patches together and this did also not fix the
> problem with the
> translation of "Volume " out of lcdproc-Plugin.

Please try the attached patch (against plain VDR 1.5.3).
There was still a problem in cCharSetConv::Convert() in case
an empty string was given.

Klaus
  

Comments

Oleg June 15, 2007, 1:52 p.m. UTC | #1
Am Freitag, 15. Juni 2007 14:58 schrieb Klaus Schmidinger:

> Please try the attached patch (against plain VDR 1.5.3).
> There was still a problem in cCharSetConv::Convert() in case
> an empty string was given.

Yes! It work's. 

THX
Oleg Roitburd
  

Patch

--- tools.c	2007/06/15 12:20:40	1.124
+++ tools.c	2007/06/15 12:46:38
@@ -753,7 +753,7 @@ 
 
 const char *cCharSetConv::Convert(const char *From, char *To, size_t ToLength)
 {
-  if (cd != (iconv_t)-1) {
+  if (cd != (iconv_t)-1 && From && *From) {
      char *FromPtr = (char *)From;
      size_t FromLength = strlen(From);
      char *ToPtr = To;
--- i18n.c	2007/06/09 08:44:54	1.294
+++ i18n.c	2007/06/15 12:52:51
@@ -6820,7 +6820,7 @@ 
      *Converted = new tI18nPhrase[NumPhrases + 1];
      memset(*Converted, 0, sizeof(tI18nPhrase) * (NumPhrases + 1));
      }
-  if (!(*Converted)[NrPhrase][NrLanguage]) {
+  if (!(*Converted)[NrPhrase][NrLanguage] && Original[NrPhrase][NrLanguage]) {
      cCharSetConv csc(Phrases[1][NrLanguage], cCharSetConv::SystemCharacterTable());
      (*Converted)[NrPhrase][NrLanguage] = strdup(csc.Convert(Original[NrPhrase][NrLanguage]));
      }
@@ -6851,7 +6851,8 @@ 
                    return t;
                 }
              }
-         p = Phrases;
+         p = OriginalPhrases = Phrases;
+         ConvertedPhrases = &Converted;
          }
      esyslog("%s%sno translation found for '%s' in language %d (%s)", Plugin ? Plugin : "", Plugin ? ": " : "", s, Setup.OSDLanguage, Phrases[0][Setup.OSDLanguage]);
      }