summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2007-08-11 14:27:02 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2007-08-11 14:27:02 +0200
commit26e2e4dee23d000f260c779947824988a4bff52c (patch)
tree5109ae55167cc95337b43c9764bf09d6dfbb2ac2
parent84184e2c03918adb9d9ed3ab0a26ddd89d124690 (diff)
downloadvdr-26e2e4dee23d000f260c779947824988a4bff52c.tar.gz
vdr-26e2e4dee23d000f260c779947824988a4bff52c.tar.bz2
Using system locale for i18n by default
-rw-r--r--HISTORY5
-rw-r--r--i18n.c13
2 files changed, 11 insertions, 7 deletions
diff --git a/HISTORY b/HISTORY
index dcb24443..ab14ac1e 100644
--- a/HISTORY
+++ b/HISTORY
@@ -5324,5 +5324,6 @@ Video Disk Recorder Revision History
- The 'newplugin' script has been extended to generate the Makefile section
for i18n support.
- The parameter OSDLanguage in 'setup.conf' is now a string and holds the locale
- code of the selcted OSD language (e.g. en_US). Therefore, when you first run
- this version of VDR you may have to select your desired OSD language again.
+ code of the selected OSD language (e.g. en_US). If Setup.OSDLanguage is not
+ set to a particular locale that is found in VDR's locale directory, the
+ locale as defined in the system environment is used by default.
diff --git a/i18n.c b/i18n.c
index a870da9e..17b954bb 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.305 2007/08/11 11:33:23 kls Exp $
+ * $Id: i18n.c 1.306 2007/08/11 14:27:02 kls Exp $
*
*
*/
@@ -57,10 +57,13 @@ void I18nInitialize(void)
char *OldLocale = strdup(setlocale(LC_MESSAGES, NULL));
for (int i = 0; i < Locales.Size(); i++) {
if (i < I18N_MAX_LANGUAGES - 1) {
- setlocale(LC_MESSAGES, Locales[i]);
- LanguageLocales.Append(strdup(Locales[i]));
- LanguageNames.Append(strdup(gettext(LanguageName)));
- LanguageCodes.Append(strdup(gettext(LanguageCode)));
+ if (setlocale(LC_MESSAGES, Locales[i])) {
+ LanguageLocales.Append(strdup(Locales[i]));
+ LanguageNames.Append(strdup(gettext(LanguageName)));
+ LanguageCodes.Append(strdup(gettext(LanguageCode)));
+ if (strstr(OldLocale, Locales[i]) == OldLocale)
+ CurrentLanguage = LanguageLocales.Size() - 1;
+ }
}
else
esyslog("ERROR: too many locales - increase I18N_MAX_LANGUAGES!");