locale names, patch for large localedirs

Message ID 46C8682F.1080200@gmail.com
State New
Headers

Commit Message

Anssi Hannula Aug. 19, 2007, 3:56 p.m. UTC
  Hi!

Very nice to see gettext() working, for a while I thought it was going
to be a complete mess :)

IMHO, two simple things could still be done:

Attached is a simple patch that allows using VDR with large localedir
that contains more locales than I18N_MAX_LANGUAGES. AFAICS there is no
reason to stop searching unless I18N_MAX_LANGUAGES vdr locales were
actually found.

Also, it is a convention (all programs in my system follow it) that .po
files (and thus the locale directory name) be without the territory
name, i.e. fi instead of fi_FI. If there would be any additional
translations for some language, they would be named like fi_DE.
  

Comments

Klaus Schmidinger Aug. 19, 2007, 4:02 p.m. UTC | #1
On 08/19/07 17:56, Anssi Hannula wrote:
> Hi!
> 
> Very nice to see gettext() working, for a while I thought it was going
> to be a complete mess :)
> 
> IMHO, two simple things could still be done:
> 
> Attached is a simple patch that allows using VDR with large localedir
> that contains more locales than I18N_MAX_LANGUAGES. AFAICS there is no
> reason to stop searching unless I18N_MAX_LANGUAGES vdr locales were
> actually found.

You're right about that.

> Also, it is a convention (all programs in my system follow it) that .po
> files (and thus the locale directory name) be without the territory
> name, i.e. fi instead of fi_FI. If there would be any additional
> translations for some language, they would be named like fi_DE.

The source .po files will remain named as they are now.
In an "install" target you can rename them to whatever you like.

Klaus
  

Patch

Index: vdr-1.5.8/i18n.c
===================================================================
--- vdr-1.5.8/i18n.c
+++ vdr-1.5.8/i18n.c	2007-08-19 18:38:54.000000000 +0300
@@ -112,7 +112,7 @@ 
      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
-            if (i < I18N_MAX_LANGUAGES - 1) {
+            if (NumLocales < I18N_MAX_LANGUAGES) {
                SetEnvLanguage(Locales[i]);
                NumLocales++;
                if (strstr(OldLocale, Locales[i]) == OldLocale)