<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <HTML> <HEAD> <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9"> <TITLE>The Linux Danish/International HOWTO: Locale support in libc 5.4.x and higher</TITLE> <LINK HREF="Danish-HOWTO-6.html" REL=next> <LINK HREF="Danish-HOWTO-4.html" REL=previous> <LINK HREF="Danish-HOWTO.html#toc5" REL=contents> </HEAD> <BODY> <A HREF="Danish-HOWTO-6.html">Next</A> <A HREF="Danish-HOWTO-4.html">Previous</A> <A HREF="Danish-HOWTO.html#toc5">Contents</A> <HR> <H2><A NAME="locale"></A> <A NAME="s5">5. Locale support in libc 5.4.x and higher</A><!--Danish!locale support--></H2> <P>The locale support has been updated in <CODE>libc 5.4.x</CODE>. You can avoid many of the individual program setups described in section <A HREF="Danish-HOWTO-3.html#apps">International character sets in specific applications</A> if the programs on your system is prepared for locale support. The Debian distribution comes with this support if you install the <CODE>wg15-locale</CODE> package. Systems with <CODE>GNU libc 2</CODE> (<CODE>libc 6.x</CODE>) support locales by default (see remarks about Red Hat Linux release 5.0 later in this section.) <P>If you use a system without locale support, you can add such support using the following method: <OL> <LI>Make sure you have the latest <CODE>libc 5.4.x</CODE> library. You can get this from <A HREF="ftp://ftp.yggdrasil.com/private/hjl/">Yggdrasil Computing</A>.</LI> <LI>Make sure you have the <CODE>localedef</CODE> program installed. It should come with the library.</LI> <LI>Get the locale sources. You can get them from DKUUG. You need to get both <A HREF="ftp://dkuug.dk/i18n/WG15-collection/locales/">locale</A> and <A HREF="ftp://dkuug.dk/i18n/WG15-collection/charmaps/">charmap</A> sources.</LI> <LI>Put the locale sources in <CODE>/usr/share/i18n/locales/</CODE> and the charmap sources in <CODE>/usr/share/i18n/charmaps/</CODE>.</LI> <LI>Execute the <CODE>localedef</CODE> program to build the locale data files: <PRE> localedef -ci da_DK -f ISO_8859-1:1987 da_DK </PRE> (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.)</LI> </OL> <P>To enable support for the Danish locale on a system with locale support you just have to set one of the following environment variables: <PRE> LANG=da_DK </PRE> or <PRE> LC_ALL=da_DK </PRE> <P>Try <CODE>da_DK.ISO_8859-1</CODE> if <CODE>da_DK</CODE> does not work. <P>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: <PRE> 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. </PRE> <P>In Red Hat Linux 5.2 you can set the environment variables LANG and/or LC_ALL in the file <CODE>/etc/sysconfig/i18n</CODE> by adding lines such as this: <PRE> LC_ALL=da_DK </PRE> <P>A few programs such as <CODE>bash</CODE> and <CODE>GNU emacs</CODE> still need specific setup as described in section <A HREF="Danish-HOWTO-3.html#apps">International character sets in specific applications</A>, but most should work without further attention. Programs such as <CODE>nvi</CODE> which did not work with 8 bit characters before should work now. <P>Locale support should be more common as distributions based on the new <CODE>GNU libc 2</CODE> become available. Beware that although Red Hat Linux release 5.0 comes with <CODE>GNU libc 2</CODE>, the locale support is not working. You have to build the locale data files by executing <CODE>localedef</CODE> yourself. You can build the Danish locale data files with the following command: <PRE> localedef -c -i da_DK -f ISO-8859-1 da_DK </PRE> <P>As of <CODE>glibc-2.0.7-4.i386.rpm</CODE> the locale data files are included with the libraries and this is no longer necessary. <P> <HR> <A HREF="Danish-HOWTO-6.html">Next</A> <A HREF="Danish-HOWTO-4.html">Previous</A> <A HREF="Danish-HOWTO.html#toc5">Contents</A> </BODY> </HTML>