[vdr] improving i18n-to-gettext.pl

Klaus Schmidinger Klaus.Schmidinger at cadsoft.de
Sat Aug 18 13:05:48 CEST 2007


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.

Klaus



More information about the vdr mailing list