On 08/18/07 10:32, Anssi Hannula wrote:
> Klaus Schmidinger wrote:
>> On 08/17/07 15:48, Anssi Hannula wrote:
>>> ...
>>> show up as "deu,ger" etc, and do not work; text shows up in English 
>>> despite selecting them.
>>> Maybe the locales that the user does not have installed on their system 
>>> should be hidden?
>> I thought that the language codes should always all be there,
>> to allow selecting other preferred languages, even if there
>> is no locale installed. But maybe I'm mistaken there.
> Well, having those in the OSD language selection menu seems strange, if 
> only two of those actually work, and others do not show up correctly 
> ("deu,ger").
> But indeed, the Audio and EPG language selection menus seem to use the 
> same list. IMHO the Audio and EPG languages should use a separate list, 
> that contains all the language names in the currently selected OSD language.

That would mean that every *.po file would have to contain the name
of every other language, and for every new language that's added, all
other *.po files would have to be extended. Besides, if a user can't
read a language name in the language's own writing, he/she probably
won't understand that langauge, anyway ;-).

>> Please try disabling the code after
>>   // Prepare any known language codes for which there was no locale:
>> in i18n.c and see whether that would do what you expect.
> Yes, the languages that have no "locales-XX" package installed on my 
> system do not show up in the OSD language selection list anymore.
> However, I cannot select them as EPG nor Audio language either, which 
> should still be possible.

Please try the attached patch.
It changes the "Setup/OSD/Language" menu to only show the languages
that actually have a locale. Any other language menus display language
names if present, three letter language codes otherwise.

--- i18n.h	2007/08/10 13:53:57	1.21
+++ i18n.h	2007/08/18 09:10:39
@@ -36,9 +36,16 @@
 void I18nSetLanguage(int Language);
    ///< Sets the current language index to Language. If Language is outside
    ///< the range of available languages, nothing happens.
+int I18nNumLanguagesWithLocale(void);
+   ///< Returns the number of entries in the list returned by I18nLanguages()
+   ///< that actually have a locale.
 const cStringList *I18nLanguages(void);
    ///< Returns the list of available languages. Values returned by
    ///< I18nCurrentLanguage() are indexes into this list.
+   ///< Only the first I18nNumLanguagesWithLocale() entries in this list
+   ///< have an actual locale installed. The rest are just dummy entries
+   ///< to allow having three letter language codes for other languages
+   ///< that have no actual locale on this system.
 const char *I18nTranslate(const char *s, const char *Plugin = NULL) __attribute_format_arg__(1);
    ///< Translates the given string (with optional Plugin context) into
    ///< the current language. If no translation is available, the original
--- i18n.c	2007/08/17 12:31:17	1.310
+++ i18n.c	2007/08/18 09:08:45
@@ -67,6 +67,7 @@
 static cStringList LanguageNames;
 static cStringList LanguageCodes;
+static int NumLocales = 1;
 static int CurrentLanguage = 0;
 static bool ContainsCode(const char *Codes, const char *Code)
@@ -105,6 +106,7 @@
      for (int i = 0; i < Locales.Size(); i++) {
          if (i < I18N_MAX_LANGUAGES - 1) {
             if (setlocale(LC_MESSAGES, Locales[i])) {
+               NumLocales++;
                if (strstr(OldLocale, Locales[i]) == OldLocale)
                   MatchFull = LanguageLocales.Size();
                else if (strncmp(OldLocale, Locales[i], 2) == 0)
@@ -177,6 +181,11 @@
+int I18nNumLanguagesWithLocale(void)
+  return NumLocales;
 const cStringList *I18nLanguages(void)
   return &LanguageNames;
--- menu.c	2007/08/12 10:44:35	1.459
+++ menu.c	2007/08/18 09:03:05
@@ -2205,7 +2205,7 @@
   useSmallFontTexts[2] = tr("always");
-  Add(new cMenuEditStraItem(tr("Setup.OSD$Language"),               &osdLanguageIndex, I18nLanguages()->Size(), &I18nLanguages()->At(0)));
+  Add(new cMenuEditStraItem(tr("Setup.OSD$Language"),               &osdLanguageIndex, I18nNumLanguagesWithLocale(), &I18nLanguages()->At(0)));
   Add(new cMenuEditStraItem(tr("Setup.OSD$Skin"),                   &skinIndex, numSkins, skinDescriptions));
   if (themes.NumThemes())
   Add(new cMenuEditStraItem(tr("Setup.OSD$Theme"),                  &themeIndex, themes.NumThemes(), themes.Descriptions()));
vdr mailing list

Reply via email to