diff options
Diffstat (limited to 'i18n.c')
-rw-r--r-- | i18n.c | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: i18n.c 1.143 2004/01/17 14:39:38 kls Exp $ + * $Id: i18n.c 1.146 2004/01/25 14:41:02 kls Exp $ * * Translations provided by: * @@ -827,7 +827,7 @@ const tI18nPhrase Phrases[] = { "",//TODO "",//TODO "",//TODO - "",//TODO + "Päivitä", "",//TODO "",//TODO "",//TODO @@ -4233,24 +4233,27 @@ const char * const * I18nCharSets(void) return &Phrases[1][0]; } -const char * I18nLanguageAbbreviation(int Index) +const char * I18nLanguageCode(int Index) { - return Index < I18nNumLanguages ? Phrases[2][Index] : NULL; + return 0 <= Index && Index < I18nNumLanguages ? Phrases[2][Index] : NULL; } -int I18nLanguageIndex(const char Code[3]) +int I18nLanguageIndex(const char *Code) { - char s[4]; - memcpy(s, Code, 3); - s[3] = 0; for (int i = 0; i < I18nNumLanguages; i++) { - if (strcasestr(Phrases[2][i], s)) + if (strcasestr(Phrases[2][i], Code)) return i; } - //dsyslog("unknown language code: '%s'", s); + //dsyslog("unknown language code: '%s'", Code); return -1; } +const char *I18nNormalizeLanguageCode(const char *Code) +{ + int n = I18nLanguageIndex(Code); + return n >= 0 ? I18nLanguageCode(n) : Code; +} + bool I18nIsPreferredLanguage(int *PreferredLanguages, int LanguageIndex, int &OldPreference) { for (int i = 0; i < I18nNumLanguages; i++) { |