[vdr] improving i18n-to-gettext.pl

Matthias Schwarzott zzam at gentoo.org
Sat Aug 18 13:10:52 CEST 2007


On Samstag, 18. August 2007, Klaus Schmidinger wrote:
> On 08/18/07 12:55, Matthias Schwarzott wrote:
> > On Freitag, 17. August 2007, Klaus Schmidinger wrote:
> >> On 08/15/07 15:07, Matthias Schwarzott wrote:
> >>> On Mittwoch, 15. August 2007, Klaus Schmidinger wrote:
> >>>
> >>> 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".
> >>> ...
> >>
> >> Could you please try the attached patch and see whether this
> >> works for you?
> >>
> >> This should, e.g., select any "de*" locale in case there is no fully
> >> matching one.
> >
> > Not yet tested, but code looks promising.
> >
> > Another way to get list of usable locales is this:
> > Checking the subdirs of /usr/lib/locale/
> > And then using all, that have associated mo file under vdr's LOCALEDIR.
> > Sadly I don't know if there is a better way than hardcoding that
> > directory.
> >
> > But "locale -a" command will give the same result - maybe analyzing its
> > code will help (or just calling this external command).
>
> Currently VDR has its own directory with all its supported locales.
> It can quickly collect all locales by going through the entries
> in that directory. I can even compile my VDR so that it searches
> for the locales in "./locale" inside the source directory.
>
> I like the simplicity of this, and wouldn't want to make it any
> more complex.
>
The directory /usr/lib/locale does NOT contain any translations, but rather a 
directory for every locale you can set via setlocale.
Its meant as a replacement of the setlocale loop.

Btw. arent these two calls identical
setlocale(LC_MESSAGES, oldLocale);
setlocale(LC_MESSAGES, "");


Matthias

-- 
Matthias Schwarzott (zzam)



More information about the vdr mailing list