Locales for Linux

Here there used to be a page about Locales for GNU/Linux, along with some rpm packages of some of them.

As now glibc comes in standard with a very wide range of locales, this page is no more needed; for support of your locale look first at what the glibc provides (look at /usr/share/i18n/locales/ in most distributions).

In case your locale is missing or incomplete, you can write me for help on creating or changing those files.

of locale/charset definitions are available. The compiled locales can be created by running: localedef -i xx_YY -f ZZZZZ -u mnemonic.ds xx
. With xx being the iso language code, YY the iso country code, and ZZZZ the charset to be used.

You can read a good explanation about localization, its meaning, its implications, and some vocabulary, from
Mozilla i18n & l10n Guidelines page and the comprehensive Concepts of C/UNIX Internationalization page of Dave Johnson.

And you can visit this very interesting and complete site on charsets encodings: http://czyborra.com/charsets/

How to use them?

That is indeed quite easy.
First you need to install the package corresponding to the language(s) you want support for, of course.
After that you need to instruct Linux which language(s) to use, there are several variables that deal with the locales, first each locale category has its own: LC_CTYPE, LC_TIME, LC_COLLATE, LC_NUMERIC, and LC_MONETARY, and the LC_ALL that overwrites and sets all the previous ones. So you can choose different locales for each category, but that is seldom done. There are also two other environnement variables that deal with locales: LANG and LANGUAGE they are quite similar and work like LC_ALL in that they define the default locales for all categories, but contrary to LC_ALL, they don't overwrite explicitely defined LC_* variables. So, for facility, generally only LANG is used to define the locale. LANGUAGE is somewhat a GNU extension to LANG, not all programs recognize it (but very few don't, and they are each time lesser), but the nice thing is that it allows to specify multiple locales, in order of preference. That is very handy, specially for people using a language which has few translations, but that know also other languages; or to people using minoritary languages.
So my advice is to use LANG if you only need one locale, and both LANG and LANGUAGE if you want several ones.

The format

The format of a locale name is ll[_CC[.EEEE]][@dddd] where ll is the two letters iso code for languages (ISO 639), in lowercase; CC is the two letter iso code for countries (ISO 3166), in uppercase; EEEEE is the charset encoding, in uppercase (there isn't really any standardization on the format; so it is generally omitted); and ddddd is an eventual dialectal variant, when the country or the charset encoding is not enough to distinguish two locales of the same language (exemples of that are no (Bokmål Norwegian) and no@nynorsk (Nynorsk Norwegian); or my *@euro that use the euro for the monetary symbol, or es@tradicional which uses the traditional sorting order of spanish, etc...)

The format of the locale definition files is defined in ISO 14652 (search it on google).

Finally...

So, from the above, you need to edit your $HOME/.profile (or whatever file is sourced at login time, be it $HOME/.Xclients, $HOME/.xinitrc or others) and put:

export LANG=xx
export LANGUAGE=xx:yy:zz:aa_BB 
With xx being your preferred language, yy, zz, aa_BB, etc being other possible locales you may want.

That's all !
Now all programs will correctly display the letters of your language (no more filtring of 8th bit by less or tin...), and (provided they had been transalted) man pages, programs interfaces and menus, etc, will show in your language.
Enjoy !



My PGP public key. (for more info on PGP you can look at http://www.pgp.net/pgpnet/)
Anything to tell me?
The Linux Webring: [ Home | Index | Next | Previous | Random | List | Stats ]