[Top][All Lists]

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

[Enigma-devel] Locales

From: Erich Schubert
Subject: [Enigma-devel] Locales
Date: Thu, 23 Jan 2014 21:02:06 +0100

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):
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

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

reply via email to

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