summaryrefslogtreecommitdiff
path: root/i18n.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2007-08-18 09:21:52 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2007-08-18 09:21:52 +0200
commit8014316a315d445e3b5f53f21fd11ff89eeb8b45 (patch)
treefecb268f5d719e902970f56d73f8ed1142397110 /i18n.c
parent48da9ba9c8f0d592f821c9a4afaca6eec7956981 (diff)
downloadvdr-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)
Diffstat (limited to 'i18n.c')
-rw-r--r--i18n.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/i18n.c b/i18n.c
index 664b8113..3818ea76 100644
--- a/i18n.c
+++ b/i18n.c
@@ -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;