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. Systems with GNU libc 2 (libc 6.x) support locales by default (see remarks about Red Hat Linux release 5.0 later in this section.)

If you use a system without locale support, you can add such support using the following method:

  1. Make sure you have the latest libc 5.4.x library. You can get this from Yggdrasil Computing.
  2. Make sure you have the localedef program installed. It should come with the library.
  3. Get the locale sources. You can get them from DKUUG. You need to get both locale and charmap sources.
  4. Put the locale sources in /usr/share/i18n/locales/ and the charmap sources in /usr/share/i18n/charmaps/.
  5. Execute the localedef program to build the locale data files:
    localedef -ci da_DK -f ISO_8859-1:1987 da_DK
    
    (Note for non-Danish readers: You can build locale data files for other locales in the same way. All locale and charmap sources are at the DKUUG site.)

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.

In Red Hat Linux 5.2 you can set the environment variables LANG and/or LC_ALL in the file /etc/sysconfig/i18n by adding lines such as this:

LC_ALL=da_DK

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 release 5.0 comes with GNU libc 2, the locale support is not working. You have to build the locale data files by executing localedef yourself. You can build the Danish locale data files with the following command:

localedef -c -i da_DK -f ISO-8859-1 da_DK

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


Next Previous Contents

Hosting by: Hurra Communications Ltd.
Generated: 2007-01-26 17:58:06