Next Previous Contents

5. Locale support in libc 5.4.x and higher

The locale support has been updated in libc 5.4.x. You can avoid many of the individual program setups described in section International character sets in specific applications if the programs on your system is prepared for locale support. The Debian distribution comes with this support if you install the wg15-locale package. Read the Locales mini-HOWTO if you want to set up locale support on a non-Debian system with libc 5.4.x. Systems with GNU libc 2 (libc 6.x) also support locales.

To enable support for the Danish locale on a system with locale support you just have to set one of the following environment variables:

LANG=da_DK
or
LC_ALL=da_DK

Try da_DK.ISO_8859-1 if da_DK does not work.

Both environment variables set all the individual locale catgories. You can also set a single locale category by using the name of the category as an environment variable. The locale catogories are:

Locale category         Application
---------------         -----------
LC_COLLATE              Collation of strings (sort order.)
LC_CTYPE                Classification and conversion of characters.
LC_MESSAGES             Translations of yes and no.
LC_MONETARY             Format of monetary values.
LC_NUMERIC              Format of non-monetary numeric values. 
LC_TIME                 Date and time formats.
LC_ALL                  Sets all of the above (overrides all of them.)
LANG                    Sets all the categories, but can be overridden
                        by the individual locale categories.

A few programs such as bash and GNU emacs still need specific setup as described in section International character sets in specific applications, but most should work without further attention. Programs such as nvi which did not work with 8 bit characters before should work now.

Locale support should be more common as distributions based on the new GNU libc 2 become available. Beware that although Red Hat Linux 5.0 comes with GNU libc 2, the locale support is not working. You have to run this script to build the locale data files before you set the appropriate environment variable(s) (ignore the warnings):

#!/bin/sh

localedef -c -i cs_CZ -f ISO-8859-2 cs_CZ
localedef -c -i da_DK -f ISO-8859-1 da_DK
localedef -c -i de_AT -f ISO-8859-1 de_AT
localedef -c -i de_BE -f ISO-8859-1 de_BE
localedef -c -i de_CH -f ISO-8859-1 de_CH
localedef -c -i de_DE -f ISO-8859-1 de_DE
localedef -c -i de_LU -f ISO-8859-1 de_LU
localedef -c -i en_CA -f ISO-8859-1 en_CA
localedef -c -i en_DK -f ISO-8859-1 en_DK
localedef -c -i en_GB -f ISO-8859-1 en_GB
localedef -c -i en_IE -f ISO-8859-1 en_IE
localedef -c -i en_US -f ISO-8859-1 en_US
localedef -c -i es_ES -f ISO-8859-1 es_ES
localedef -c -i et_EE -f ISO-8859-1 et_EE
localedef -c -i eu_ES -f ISO-8859-1 eu_ES
localedef -c -i fi_FI -f ISO-8859-1 fi_FI
localedef -c -i fo_FO -f ISO-8859-1 fo_FO
localedef -c -i fr_BE -f ISO-8859-1 fr_BE
localedef -c -i fr_CA -f ISO-8859-1 fr_CA
localedef -c -i fr_CH -f ISO-8859-1 fr_CH
localedef -c -i fr_FR -f ISO-8859-1 fr_FR
localedef -c -i fr_LU -f ISO-8859-1 fr_LU
localedef -c -i ga_IE -f ISO-8859-1 ga_IE
localedef -c -i gr_GR -f ISO-8859-7 gr_GR
localedef -c -i hr_HR -f ISO-8859-2 hr_HR
localedef -c -i hu_HU -f ISO-8859-2 hu_HU
localedef -c -i is_IS -f ISO-8859-1 is_IS
localedef -c -i it_IT -f ISO-8859-1 it_IT
localedef -c -i iw_IL -f ISO-8859-8 iw_IL
localedef -c -i kl_GL -f ISO-8859-1 kl_GL
localedef -c -i lt_LT -f BALTIC lt_LT
localedef -c -i lv_LV -f BALTIC lv_LV
localedef -c -i nl_BE -f ISO-8859-1 nl_BE
localedef -c -i nl_NL -f ISO-8859-1 nl_NL
localedef -c -i no_NO -f ISO-8859-1 no_NO
localedef -c -i pl_PL -f ISO-8859-2 pl_PL
localedef -c -i pt_BR -f ISO-8859-1 pt_BR
localedef -c -i pt_PT -f ISO-8859-1 pt_PT
localedef -c -i ro_RO -f ISO-8859-2 ro_RO
localedef -c -i ru_RU -f ISO-8859-5 ru_RU
localedef -c -i sl_SI -f ISO-8859-2 sl_SI
localedef -c -i sv_FI -f ISO-8859-1 sv_FI
localedef -c -i sv_SE -f ISO-8859-1 sv_SE
localedef -c -i tr_TR -f ISO-8859-9 tr_TR

As of glibc-2.0.7-4.i386.rpm the locale data files are included with the libraries and this script is no longer necessary.


Next Previous Contents