1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed detecting whether a particular locale is actually supported

This commit is contained in:
Klaus Schmidinger 2007-08-24 13:09:09 +02:00
parent f075b1cea7
commit 1998a2fb62
2 changed files with 17 additions and 13 deletions

View File

@ -5387,3 +5387,4 @@ Video Disk Recorder Revision History
- Updated Turkish language texts (thanks to Oktay Yolgeçen). - Updated Turkish language texts (thanks to Oktay Yolgeçen).
- Fixed stripping the context in I18nTranslate() (reported by Christian - Fixed stripping the context in I18nTranslate() (reported by Christian
Wieninger). Wieninger).
- Fixed detecting whether a particular locale is actually supported.

7
i18n.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: i18n.c 1.314 2007/08/24 12:53:53 kls Exp $ * $Id: i18n.c 1.315 2007/08/24 13:08:04 kls Exp $
* *
* *
*/ */
@ -114,11 +114,13 @@ void I18nInitialize(void)
if (access(FileName, F_OK) == 0) { // found a locale with VDR texts if (access(FileName, F_OK) == 0) { // found a locale with VDR texts
if (NumLocales < I18N_MAX_LANGUAGES - 1) { if (NumLocales < I18N_MAX_LANGUAGES - 1) {
SetEnvLanguage(Locales[i]); SetEnvLanguage(Locales[i]);
const char *TranslatedLanguageName = gettext(LanguageName);
if (TranslatedLanguageName != LanguageName) {
NumLocales++; NumLocales++;
if (strstr(OldLocale, Locales[i]) == OldLocale) if (strstr(OldLocale, Locales[i]) == OldLocale)
CurrentLanguage = LanguageLocales.Size(); CurrentLanguage = LanguageLocales.Size();
LanguageLocales.Append(strdup(Locales[i])); LanguageLocales.Append(strdup(Locales[i]));
LanguageNames.Append(strdup(gettext(LanguageName))); LanguageNames.Append(strdup(TranslatedLanguageName));
const char *Code = gettext(LanguageCode); const char *Code = gettext(LanguageCode);
for (const char **lc = LanguageCodeList; *lc; lc++) { for (const char **lc = LanguageCodeList; *lc; lc++) {
if (ContainsCode(*lc, Code)) { if (ContainsCode(*lc, Code)) {
@ -128,6 +130,7 @@ void I18nInitialize(void)
} }
LanguageCodes.Append(strdup(Code)); LanguageCodes.Append(strdup(Code));
} }
}
else { else {
esyslog("ERROR: too many locales - increase I18N_MAX_LANGUAGES!"); esyslog("ERROR: too many locales - increase I18N_MAX_LANGUAGES!");
break; break;