[vdr] Problem with locales and gettext

Patrick Maier maierp at informatik.tu-muenchen.de
Sun Dec 16 03:04:06 CET 2007


Hi,
I've a problem with the locales.
Everytime I start my server with VDR, the locales are not recognized.

I've done a bit of debugging output to see where the problem is located.
The entries (*.mo) in the "locales" directory are found.
The environment is set correctly,
but the "LanguageName" is not translated with the gettext function.

When I restart the vdr-process, the locales are found.

Where is the problem?

==== i18n.c =====
  textdomain("vdr");
  bindtextdomain("vdr", I18nLocaleDir);
  cFileNameList Locales(I18nLocaleDir, true);
  if (Locales.Size() > 0) {
     char *OldLocale = strdup(setlocale(LC_MESSAGES, NULL));
     for (int i = 0; i < Locales.Size(); i++) {
         cString FileName = cString::sprintf("%s/%s/LC_MESSAGES/vdr.mo", 
I18nLocaleDir, Locales[i]);
         if (access(FileName, F_OK) == 0) { // found a locale with VDR texts
            dsyslog("%s/%s/LC_MESSAGES/vdr.mo", I18nLocaleDir, Locales[i]);
            if (NumLocales < I18N_MAX_LANGUAGES - 1) {
               SetEnvLanguage(Locales[i]);
               dsyslog("%s/%s", Locales[i], getenv("LANGUAGE"));
               const char *TranslatedLanguageName = gettext(LanguageName);
               dsyslog("%s/%s",LanguageName,TranslatedLanguageName);
               if (TranslatedLanguageName != LanguageName) {
                  NumLocales++;
                  if (strstr(OldLocale, Locales[i]) == OldLocale)
                     CurrentLanguage = LanguageLocales.Size();
                  LanguageLocales.Append(strdup(Locales[i]));
                  LanguageNames.Append(strdup(TranslatedLanguageName));
                  const char *Code = gettext(LanguageCode);
                  for (const char **lc = LanguageCodeList; *lc; lc++) {
                      if (ContainsCode(*lc, Code)) {
                         Code = *lc;
                         break;
                         }
                      }
                  LanguageCodes.Append(strdup(Code));
                  }
               }
            else {
               esyslog("ERROR: too many locales - increase 
I18N_MAX_LANGUAGES!");
               break;
               }
            }
         }
     SetEnvLanguage(LanguageLocales[CurrentLanguage]);
     free(OldLocale);
     dsyslog("found %d locales in %s", NumLocales - 1, I18nLocaleDir);
     }
==========
== no locales are found ===
Dec 16 02:30:21 vdr vdr: [2292] VDR version 1.5.12 started
Dec 16 02:30:21 vdr vdr: [2292] codeset is 'ISO-8859-15' - known
Dec 16 02:30:21 vdr vdr: [2292] 
/usr/local/video/VDR/locale/ca_ES/LC_MESSAGES/vdr.mo
Dec 16 02:30:21 vdr vdr: [2292] ca_ES/ca_ES
Dec 16 02:30:21 vdr vdr: [2292] LanguageName$English/LanguageName$English
Dec 16 02:30:21 vdr vdr: [2292] 
/usr/local/video/VDR/locale/cs_CZ/LC_MESSAGES/vdr.mo
Dec 16 02:30:21 vdr vdr: [2292] cs_CZ/cs_CZ
Dec 16 02:30:21 vdr vdr: [2292] LanguageName$English/LanguageName$English
Dec 16 02:30:21 vdr vdr: [2292] 
/usr/local/video/VDR/locale/da_DK/LC_MESSAGES/vdr.mo
Dec 16 02:30:21 vdr vdr: [2292] da_DK/da_DK
Dec 16 02:30:21 vdr vdr: [2292] LanguageName$English/LanguageName$English
Dec 16 02:30:21 vdr vdr: [2292] 
/usr/local/video/VDR/locale/de_DE/LC_MESSAGES/vdr.mo
Dec 16 02:30:21 vdr vdr: [2292] de_DE/de_DE
Dec 16 02:30:21 vdr vdr: [2292] LanguageName$English/LanguageName$English
Dec 16 02:30:21 vdr vdr: [2292] 
/usr/local/video/VDR/locale/el_GR/LC_MESSAGES/vdr.mo
Dec 16 02:30:21 vdr vdr: [2292] el_GR/el_GR
Dec 16 02:30:21 vdr vdr: [2292] LanguageName$English/LanguageName$English
Dec 16 02:30:21 vdr vdr: [2292] 
/usr/local/video/VDR/locale/es_ES/LC_MESSAGES/vdr.mo
Dec 16 02:30:21 vdr vdr: [2292] es_ES/es_ES
Dec 16 02:30:21 vdr vdr: [2292] LanguageName$English/LanguageName$English
Dec 16 02:30:21 vdr vdr: [2292] 
/usr/local/video/VDR/locale/et_EE/LC_MESSAGES/vdr.mo
Dec 16 02:30:21 vdr vdr: [2292] et_EE/et_EE
Dec 16 02:30:21 vdr vdr: [2292] LanguageName$English/LanguageName$English
Dec 16 02:30:21 vdr vdr: [2292] 
/usr/local/video/VDR/locale/fi_FI/LC_MESSAGES/vdr.mo
Dec 16 02:30:21 vdr vdr: [2292] fi_FI/fi_FI
Dec 16 02:30:21 vdr vdr: [2292] LanguageName$English/LanguageName$English
Dec 16 02:30:21 vdr vdr: [2292] 
/usr/local/video/VDR/locale/fr_FR/LC_MESSAGES/vdr.mo
Dec 16 02:30:21 vdr vdr: [2292] fr_FR/fr_FR
Dec 16 02:30:21 vdr vdr: [2292] LanguageName$English/LanguageName$English
Dec 16 02:30:21 vdr vdr: [2292] 
/usr/local/video/VDR/locale/hr_HR/LC_MESSAGES/vdr.mo
Dec 16 02:30:21 vdr vdr: [2292] hr_HR/hr_HR
Dec 16 02:30:21 vdr vdr: [2292] LanguageName$English/LanguageName$English
Dec 16 02:30:21 vdr vdr: [2292] 
/usr/local/video/VDR/locale/hu_HU/LC_MESSAGES/vdr.mo
Dec 16 02:30:21 vdr vdr: [2292] hu_HU/hu_HU
Dec 16 02:30:21 vdr vdr: [2292] LanguageName$English/LanguageName$English
Dec 16 02:30:21 vdr vdr: [2292] 
/usr/local/video/VDR/locale/it_IT/LC_MESSAGES/vdr.mo
Dec 16 02:30:21 vdr vdr: [2292] it_IT/it_IT
Dec 16 02:30:21 vdr vdr: [2292] LanguageName$English/LanguageName$English
Dec 16 02:30:21 vdr vdr: [2292] 
/usr/local/video/VDR/locale/nl_NL/LC_MESSAGES/vdr.mo
Dec 16 02:30:21 vdr vdr: [2292] nl_NL/nl_NL
Dec 16 02:30:21 vdr vdr: [2292] LanguageName$English/LanguageName$English
Dec 16 02:30:21 vdr vdr: [2292] 
/usr/local/video/VDR/locale/nn_NO/LC_MESSAGES/vdr.mo
Dec 16 02:30:21 vdr vdr: [2292] nn_NO/nn_NO
Dec 16 02:30:21 vdr vdr: [2292] LanguageName$English/LanguageName$English
Dec 16 02:30:21 vdr vdr: [2292] 
/usr/local/video/VDR/locale/pl_PL/LC_MESSAGES/vdr.mo
Dec 16 02:30:21 vdr vdr: [2292] pl_PL/pl_PL
Dec 16 02:30:21 vdr vdr: [2292] LanguageName$English/LanguageName$English
Dec 16 02:30:21 vdr vdr: [2292] 
/usr/local/video/VDR/locale/pt_PT/LC_MESSAGES/vdr.mo
Dec 16 02:30:21 vdr vdr: [2292] pt_PT/pt_PT
Dec 16 02:30:21 vdr vdr: [2292] LanguageName$English/LanguageName$English
Dec 16 02:30:21 vdr vdr: [2292] 
/usr/local/video/VDR/locale/ro_RO/LC_MESSAGES/vdr.mo
Dec 16 02:30:21 vdr vdr: [2292] ro_RO/ro_RO
Dec 16 02:30:21 vdr vdr: [2292] LanguageName$English/LanguageName$English
Dec 16 02:30:22 vdr vdr: [2292] 
/usr/local/video/VDR/locale/ru_RU/LC_MESSAGES/vdr.mo
Dec 16 02:30:22 vdr vdr: [2292] ru_RU/ru_RU
Dec 16 02:30:22 vdr vdr: [2292] LanguageName$English/LanguageName$English
Dec 16 02:30:22 vdr vdr: [2292] 
/usr/local/video/VDR/locale/sl_SI/LC_MESSAGES/vdr.mo
Dec 16 02:30:22 vdr vdr: [2292] sl_SI/sl_SI
Dec 16 02:30:22 vdr vdr: [2292] LanguageName$English/LanguageName$English
Dec 16 02:30:22 vdr vdr: [2292] 
/usr/local/video/VDR/locale/sv_SE/LC_MESSAGES/vdr.mo
Dec 16 02:30:22 vdr vdr: [2292] sv_SE/sv_SE
Dec 16 02:30:22 vdr vdr: [2292] LanguageName$English/LanguageName$English
Dec 16 02:30:22 vdr vdr: [2292] 
/usr/local/video/VDR/locale/tr_TR/LC_MESSAGES/vdr.mo
Dec 16 02:30:22 vdr vdr: [2292] tr_TR/tr_TR
Dec 16 02:30:22 vdr vdr: [2292] LanguageName$English/LanguageName$English
Dec 16 02:30:22 vdr vdr: [2292] 
/usr/local/video/VDR/locale/uk_UA/LC_MESSAGES/vdr.mo
Dec 16 02:30:22 vdr vdr: [2292] uk_UA/uk_UA
Dec 16 02:30:22 vdr vdr: [2292] LanguageName$English/LanguageName$English
Dec 16 02:30:22 vdr vdr: [2292] found 0 locales in 
/usr/local/video/VDR/locale
Dec 16 02:30:22 vdr vdr: [2292] no locale for language code 'deu,ger'
Dec 16 02:30:22 vdr vdr: [2292] no locale for language code 'slv,slo'
Dec 16 02:30:22 vdr vdr: [2292] no locale for language code 'ita'
Dec 16 02:30:22 vdr vdr: [2292] no locale for language code 'dut,nla,nld'
Dec 16 02:30:22 vdr vdr: [2292] no locale for language code 'por'
Dec 16 02:30:22 vdr vdr: [2292] no locale for language code 'fra,fre'
Dec 16 02:30:22 vdr vdr: [2292] no locale for language code 'nor'
Dec 16 02:30:22 vdr vdr: [2292] no locale for language code 'fin,smi'
Dec 16 02:30:22 vdr vdr: [2292] no locale for language code 'pol'
Dec 16 02:30:22 vdr vdr: [2292] no locale for language code 'esl,spa'
Dec 16 02:30:22 vdr vdr: [2292] no locale for language code 'ell,gre'
Dec 16 02:30:22 vdr vdr: [2292] no locale for language code 'sve,swe'
Dec 16 02:30:22 vdr vdr: [2292] no locale for language code 'rom,rum'
Dec 16 02:30:22 vdr vdr: [2292] no locale for language code 'hun'
Dec 16 02:30:22 vdr vdr: [2292] no locale for language code 'cat,cln'
Dec 16 02:30:22 vdr vdr: [2292] no locale for language code 'rus'
Dec 16 02:30:22 vdr vdr: [2292] no locale for language code 'hrv'
Dec 16 02:30:22 vdr vdr: [2292] no locale for language code 'est'
Dec 16 02:30:22 vdr vdr: [2292] no locale for language code 'dan'
Dec 16 02:30:22 vdr vdr: [2292] no locale for language code 'cze,ces'
Dec 16 02:30:22 vdr vdr: [2292] no locale for language code 'tur'
Dec 16 02:30:22 vdr vdr: [2292] no locale for language code 'ukr'
Dec 16 02:30:22 vdr vdr: [2292] loading /etc/vdr/setup.conf
Dec 16 02:30:22 vdr vdr: [2292] unknown locale: 'de_DE'
=======
=== after a restart of vdr all is ok ===
Dec 16 02:56:18 vdr vdr: [2386] VDR version 1.5.12 started
Dec 16 02:56:18 vdr vdr: [2386] codeset is 'ISO-8859-15' - known
Dec 16 02:56:18 vdr vdr: [2386] 
/usr/local/video/VDR/locale/ca_ES/LC_MESSAGES/vdr.mo
Dec 16 02:56:18 vdr vdr: [2386] ca_ES/ca_ES
Dec 16 02:56:19 vdr vdr: [2386] LanguageName$English/Català
Dec 16 02:56:19 vdr vdr: [2386] 
/usr/local/video/VDR/locale/cs_CZ/LC_MESSAGES/vdr.mo
Dec 16 02:56:19 vdr vdr: [2386] cs_CZ/cs_CZ
Dec 16 02:56:19 vdr vdr: [2386] LanguageName$English/Cesky
Dec 16 02:56:19 vdr vdr: [2386] 
/usr/local/video/VDR/locale/da_DK/LC_MESSAGES/vdr.mo
Dec 16 02:56:19 vdr vdr: [2386] da_DK/da_DK
Dec 16 02:56:19 vdr vdr: [2386] LanguageName$English/Dansk
Dec 16 02:56:19 vdr vdr: [2386] 
/usr/local/video/VDR/locale/de_DE/LC_MESSAGES/vdr.mo
Dec 16 02:56:19 vdr vdr: [2386] de_DE/de_DE
Dec 16 02:56:19 vdr vdr: [2386] LanguageName$English/Deutsch
Dec 16 02:56:19 vdr vdr: [2386] 
/usr/local/video/VDR/locale/el_GR/LC_MESSAGES/vdr.mo
Dec 16 02:56:19 vdr vdr: [2386] el_GR/el_GR
Dec 16 02:56:19 vdr vdr: [2386] LanguageName$English/????????
Dec 16 02:56:19 vdr vdr: [2386] 
/usr/local/video/VDR/locale/es_ES/LC_MESSAGES/vdr.mo
Dec 16 02:56:19 vdr vdr: [2386] es_ES/es_ES
Dec 16 02:56:19 vdr vdr: [2386] LanguageName$English/Español
Dec 16 02:56:19 vdr vdr: [2386] 
/usr/local/video/VDR/locale/et_EE/LC_MESSAGES/vdr.mo
Dec 16 02:56:19 vdr vdr: [2386] et_EE/et_EE
Dec 16 02:56:19 vdr vdr: [2386] LanguageName$English/eesti
Dec 16 02:56:19 vdr vdr: [2386] 
/usr/local/video/VDR/locale/fi_FI/LC_MESSAGES/vdr.mo
Dec 16 02:56:19 vdr vdr: [2386] fi_FI/fi_FI
Dec 16 02:56:19 vdr vdr: [2386] LanguageName$English/suomi
Dec 16 02:56:19 vdr vdr: [2386] 
/usr/local/video/VDR/locale/fr_FR/LC_MESSAGES/vdr.mo
Dec 16 02:56:19 vdr vdr: [2386] fr_FR/fr_FR
Dec 16 02:56:19 vdr vdr: [2386] LanguageName$English/Français
Dec 16 02:56:19 vdr vdr: [2386] 
/usr/local/video/VDR/locale/hr_HR/LC_MESSAGES/vdr.mo
Dec 16 02:56:19 vdr vdr: [2386] hr_HR/hr_HR
Dec 16 02:56:19 vdr vdr: [2386] LanguageName$English/Hrvatski
Dec 16 02:56:19 vdr vdr: [2386] 
/usr/local/video/VDR/locale/hu_HU/LC_MESSAGES/vdr.mo
Dec 16 02:56:19 vdr vdr: [2386] hu_HU/hu_HU
Dec 16 02:56:19 vdr vdr: [2386] LanguageName$English/Magyar
Dec 16 02:56:19 vdr vdr: [2386] 
/usr/local/video/VDR/locale/it_IT/LC_MESSAGES/vdr.mo
Dec 16 02:56:19 vdr vdr: [2386] it_IT/it_IT
Dec 16 02:56:19 vdr vdr: [2386] LanguageName$English/Italiano
Dec 16 02:56:19 vdr vdr: [2386] 
/usr/local/video/VDR/locale/nl_NL/LC_MESSAGES/vdr.mo
Dec 16 02:56:19 vdr vdr: [2386] nl_NL/nl_NL
Dec 16 02:56:19 vdr vdr: [2386] LanguageName$English/Nederlands
Dec 16 02:56:19 vdr vdr: [2386] 
/usr/local/video/VDR/locale/nn_NO/LC_MESSAGES/vdr.mo
Dec 16 02:56:19 vdr vdr: [2386] nn_NO/nn_NO
Dec 16 02:56:19 vdr vdr: [2386] LanguageName$English/Norsk
Dec 16 02:56:19 vdr vdr: [2386] 
/usr/local/video/VDR/locale/pl_PL/LC_MESSAGES/vdr.mo
Dec 16 02:56:19 vdr vdr: [2386] pl_PL/pl_PL
Dec 16 02:56:19 vdr vdr: [2386] LanguageName$English/Polski
Dec 16 02:56:19 vdr vdr: [2386] 
/usr/local/video/VDR/locale/pt_PT/LC_MESSAGES/vdr.mo
Dec 16 02:56:19 vdr vdr: [2386] pt_PT/pt_PT
Dec 16 02:56:19 vdr vdr: [2386] LanguageName$English/Português
Dec 16 02:56:19 vdr vdr: [2386] 
/usr/local/video/VDR/locale/ro_RO/LC_MESSAGES/vdr.mo
Dec 16 02:56:19 vdr vdr: [2386] ro_RO/ro_RO
Dec 16 02:56:19 vdr vdr: [2386] LanguageName$English/Româna
Dec 16 02:56:19 vdr vdr: [2386] 
/usr/local/video/VDR/locale/ru_RU/LC_MESSAGES/vdr.mo
Dec 16 02:56:19 vdr vdr: [2386] ru_RU/ru_RU
Dec 16 02:56:19 vdr vdr: [2386] LanguageName$English/???????
Dec 16 02:56:19 vdr vdr: [2386] 
/usr/local/video/VDR/locale/sl_SI/LC_MESSAGES/vdr.mo
Dec 16 02:56:19 vdr vdr: [2386] sl_SI/sl_SI
Dec 16 02:56:19 vdr vdr: [2386] LanguageName$English/Slovenski
Dec 16 02:56:19 vdr vdr: [2386] 
/usr/local/video/VDR/locale/sv_SE/LC_MESSAGES/vdr.mo
Dec 16 02:56:19 vdr vdr: [2386] sv_SE/sv_SE
Dec 16 02:56:19 vdr vdr: [2386] LanguageName$English/Svenska
Dec 16 02:56:19 vdr vdr: [2386] 
/usr/local/video/VDR/locale/tr_TR/LC_MESSAGES/vdr.mo
Dec 16 02:56:19 vdr vdr: [2386] tr_TR/tr_TR
Dec 16 02:56:19 vdr vdr: [2386] LanguageName$English/Türkçe
Dec 16 02:56:19 vdr vdr: [2386] 
/usr/local/video/VDR/locale/uk_UA/LC_MESSAGES/vdr.mo
Dec 16 02:56:19 vdr vdr: [2386] uk_UA/uk_UA
Dec 16 02:56:19 vdr vdr: [2386] LanguageName$English/??????????
Dec 16 02:56:19 vdr vdr: [2386] found 22 locales in 
/usr/local/video/VDR/locale

Thank you, greets
Patrick 




More information about the vdr mailing list