enigma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Enigma-devel] Locales


From: Andreas Lochmann
Subject: Re: [Enigma-devel] Locales
Date: Sun, 23 Feb 2014 20:02:53 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120605 Thunderbird/13.0

Hi Erich,

your hesitation about your hotfix was
justified - it actually didn't work on Windows.
I now submitted a minimal solution, in which
your changes do not apply to Mac and Win.
I tested this on my Win 7, but it would be
great if some others could test the locales
of the current trunk on their systems.
(My Fedora worked well before, and is still
okay with the patch.)

Best regards,
Andreas


Am 27.01.2014 10:32, schrieb Erich Schubert:
> Hi Andreas,
> The relevant part of the patch is attached.
> (The other parts were to make sure system-gettext is used, not the
> code included in enigma).
>
> I exploit that setlocale returns NULL when the locale is not available:
> if (setlocale (LC_MESSAGES, val) != NULL)
> then I just retry with locale + ".UTF-8"
>
> Regards,
> Erich
>
> On Mon, Jan 27, 2014 at 1:13 AM, Andreas Lochmann
> <address@hidden> wrote:
>> Hi Erich,
>>
>> thank you for investigating into this problem,
>> I always wondered myself what might be the
>> bug here.
>>
>> Could you send me your brute-force fix to
>> take a look at?
>>
>> Best regards,
>> Andreas
>>
>>
>> Am 23.01.2014 21:02, schrieb Erich Schubert:
>>> Hi all,
>>> I've uploaded a new enigma build with some tiny fixes to Debian (which
>>> will also end up in Ubuntu).
>>>
>>> There was one issue that got really on my nerves: locales.
>>>
>>> First of all, there is a tiny bug: there is no en_EN, only en_GB and en_US. 
>>> ;-)
>>>
>>> So locales weren't working for lots of people on Linux.
>>> I've looked into this, and unfortunately, locale names are quite fragile.
>>> Current enigma assumes that all supported locales are installed, and
>>> have well-known names. And unfortunately, gettext doesn't try too hard
>>> to solve any ambiguities.
>>>
>>> On my system, the installed locales are (I try to save disk space):
>>> ---
>>> C
>>> C.UTF-8
>>> de_DE.utf8
>>> POSIX
>>> ---
>>> Enigma on the other hand tries to use "de_DE", which is an alias for
>>> "de_DE.ISO-8859-1" - and which is not available on my system.
>>>
>>> The hotfix I uploaded is more of a brute force approach. When a locale
>>> is not available (setlocale returning null), it will try appending
>>> .UTF8 - because the only cases I'm aware of where the default charset
>>> changed - and retry.
>>> For locales not available, the flag icon will be there but not work.
>>>
>>> Maybe we can A) investigate, if the two-letter codes maybe work
>>> better? B) setting $LANGUAGE instead of $LANG is more robust, C)
>>> options to enumerate available locales, akin to "locale -a", D) grab
>>> the system locale, see if it matches a known language, and use it then
>>> and E) not show flag icons that seem to be unsupported (setlocale
>>> returning null).
>>>
>>> Since I'm not sure if the "localename" is used somewhere except in the
>>> language chooser GUI and gettext, I didn't want to do more invasive
>>> changes.
>>>
>>> As for A), this doesn't appear to be the case:
>>> "" -> de_DE.utf8
>>> de -> (null)
>>> en -> (null)
>>> de_DE -> (null)
>>> de_DE.UTF-8 -> de_DE.UTF-8
>>>
>>> As you can see, the .UTF-8 postfix is needed on my system. The return
>>> of "" can be used as a default, and can be recognized as "de" locale.
>>> If I additionally generate the "de_DE.ISO-8859-1" locale, then "de_DE"
>>> works, but likely yields the latin1 encoded locale (which doesn't have
>>> the € symbol)
>>>
>>> An alternate approach would be to have a list of locale names for each
>>> language, for example for German we could try
>>> de_DE.UTF-8, address@hidden, de_DE.ISO-8859-1, de_DE, de,
>>> de_AT.UTF-8, de_CH.UTF-8
>>> and choose whichever is accepted by "setlocale" first. If none is
>>> accepted, drop it at runtime from the locales list (E).
>>>
>>> best regards,
>>> Erich Schubert
>>>
>>> _______________________________________________
>>> Enigma-devel mailing list
>>> address@hidden
>>> https://lists.nongnu.org/mailman/listinfo/enigma-devel
>>
>
>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]