[vdr] improving i18n-to-gettext.pl

Matthias Schwarzott zzam at gentoo.org
Wed Aug 15 15:07:57 CEST 2007


On Mittwoch, 15. August 2007, Klaus Schmidinger wrote:
> On 08/15/07 14:02, Matthias Schwarzott wrote:
> > On Mittwoch, 15. August 2007, Matthias Fechner wrote:
> >> Hi Matthias,
> >>
> >>
> >> because German is spoken in more then one country: de_DE, de_AT and I
> >> think de_CH and more. I havn't not list with all locales here now.
> >
> > Yeah, german is spoken in other countries. Is there then a reason to
> > restrict the translation to germany?
> >
> > some example:
> > wget installs the file /usr/share/locale/de/LC_MESSAGES/wget.mo
> > this is to provide translations for "all" de* locales. Not just the
> > german one, but also for austria and swiss.
>
> I just tried renaming VDR's "de_DE" locale to "de" and did
>
> LC_ALL=de_AT ./vdr
>
This will work, but only if the locale de_AT you set does exist (being in 
output of locale -a).
> but it came up with the default English texts. Then I renamed
> "de" to "de_AT" and did the same again, and I got the German texts.
>
> I was hoping that gettext would be a little more intelligent and
> look for
>
> - an exact match ("de_AT")
> - a default ("de")
> - any suitable language ("de_DE")

I think it does this but not doing "any suitable language".

trying it with ls:
# LC_ALL=de_DE strace ls xxx

open("/usr/share/locale/de_DE.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 
ENOENT (No such file or directory)
open("/usr/share/locale/de_DE/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT 
(No such file or directory)
open("/usr/share/locale/de.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 
ENOENT (No such file or directory)
open("/usr/share/locale/de/LC_MESSAGES/coreutils.mo", O_RDONLY) = 3

You can see that gettext does this:
1. Trying the set locale with some different charsets (de_DE.utf8, de_DE)
2. stripping of country and trying language with different charsets (de.utf8, 
de).

Only condition is that the locale one sets LC_MESSAGES to must exist.


Now my tests: I created de_DE and de_AT locales on my system, but not de_CH.

# LC_ALL=de_DE ls zzzz
ls: Zugriff auf zzzz nicht möglich: Datei oder Verzeichnis nicht gefunden
# LC_ALL=de_AT ls zzzz
ls: Zugriff auf zzzz nicht möglich: Datei oder Verzeichnis nicht gefunden
# LC_ALL=de_CH ls zzzz
ls: cannot access zzzz: No such file or directory

# LC_ALL=de ls zzz
ls: cannot access zzzz: No such file or directory

The reason vdr does not work with directory called de is the same as LC_ALL=de 
will not work.
There is no locale called de even if the directory is called de.


Matthias

-- 
Matthias Schwarzott (zzam)



More information about the vdr mailing list