diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2007-08-18 09:21:52 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2007-08-18 09:21:52 +0200 |
commit | 8014316a315d445e3b5f53f21fd11ff89eeb8b45 (patch) | |
tree | fecb268f5d719e902970f56d73f8ed1142397110 | |
parent | 48da9ba9c8f0d592f821c9a4afaca6eec7956981 (diff) | |
download | vdr-8014316a315d445e3b5f53f21fd11ff89eeb8b45.tar.gz vdr-8014316a315d445e3b5f53f21fd11ff89eeb8b45.tar.bz2 |
The "Setup/OSD/Language" menu now only shows those languages that actually have a locale (suggested by Anssi Hannula)
-rw-r--r-- | CONTRIBUTORS | 2 | ||||
-rw-r--r-- | HISTORY | 4 | ||||
-rw-r--r-- | i18n.c | 13 | ||||
-rw-r--r-- | i18n.h | 9 | ||||
-rw-r--r-- | menu.c | 4 |
5 files changed, 26 insertions, 6 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index e507cc3f..96495fda 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2058,6 +2058,8 @@ Anssi Hannula <anssi.hannula@gmail.com> for fixing handling frequencies in NitFilter::Process() for making non-primary devices in Transfer mode be also used for recording for code and hints on how to use 'fontconfig' to determine which fonts to use + for suggesting to make the "Setup/OSD/Language" menu only show those languages + that actually have a locale Antti Hartikainen <ami+vdr@ah.fi> for updating 'S13E' in 'sources.conf' @@ -5346,7 +5346,7 @@ Video Disk Recorder Revision History - Added a debug error message to cReceiver::~cReceiver() in case it is still attached to a device (thanks to Reinhard Nissl). -2007-08-17: Version 1.5.8 +2007-08-18: Version 1.5.8 - Added missing install-i18n to the install target in the Makefile (reported by Joachim Wilke). @@ -5372,3 +5372,5 @@ Video Disk Recorder Revision History (thanks to Tobias Bratfisch). - Changed cBitmap::DrawText() to always draw the background unless ColorBg is clrTransparent (thanks to Christoph Haubrich). +- The "Setup/OSD/Language" menu now only shows those languages that actually + have a locale (suggested by Anssi Hannula). @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: i18n.c 1.310 2007/08/17 12:31:17 kls Exp $ + * $Id: i18n.c 1.311 2007/08/18 09:08:45 kls Exp $ * * */ @@ -67,6 +67,7 @@ static cStringList LanguageLocales; 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 @@ void I18nInitialize(void) 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) @@ -121,8 +123,10 @@ void I18nInitialize(void) LanguageCodes.Append(strdup(Code)); } } - else + else { esyslog("ERROR: too many locales - increase I18N_MAX_LANGUAGES!"); + break; + } } CurrentLanguage = MatchFull ? MatchFull : MatchPartial; setlocale(LC_MESSAGES, CurrentLanguage ? LanguageLocales[CurrentLanguage] : OldLocale); @@ -177,6 +181,11 @@ void I18nSetLanguage(int Language) } } +int I18nNumLanguagesWithLocale(void) +{ + return NumLocales; +} + const cStringList *I18nLanguages(void) { return &LanguageNames; @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: i18n.h 1.21 2007/08/10 13:53:57 kls Exp $ + * $Id: i18n.h 1.22 2007/08/18 09:10:39 kls Exp $ */ #ifndef __I18N_H @@ -36,9 +36,16 @@ int I18nCurrentLanguage(void); 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 @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.459 2007/08/12 10:44:35 kls Exp $ + * $Id: menu.c 1.460 2007/08/18 09:03:05 kls Exp $ */ #include "menu.h" @@ -2205,7 +2205,7 @@ void cMenuSetupOSD::Set(void) useSmallFontTexts[2] = tr("always"); Clear(); SetSection(tr("OSD")); - 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())); |