source: BOOK/bootscripts/common/locale.xml@ d0123a37

clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since d0123a37 was 229ed25, checked in by Chris Staub <chris@…>, 11 years ago

Merge branch 'master' into systemd

Conflicts:

BOOK/appendices/dependencies/common.xml
BOOK/boot/common/devices.xml
BOOK/boot/common/pwdgroup.xml
BOOK/boot/ppc64-64/powerpc-utils.xml
BOOK/boot/ppc64/util-linux-32.xml
BOOK/bootscripts/common/bootscripts.xml
BOOK/final-system/alpha-chapter.xml
BOOK/final-system/common/coreutils.xml
BOOK/final-system/common/eudev.xml
BOOK/final-system/common/kbd.xml
BOOK/final-system/mips-chapter.xml
BOOK/final-system/mips64-64-chapter.xml
BOOK/final-system/mips64-chapter.xml
BOOK/final-system/multilib/udev-64bit.xml
BOOK/final-system/multilib/util-linux.xml
BOOK/final-system/ppc-chapter.xml
BOOK/final-system/ppc64-chapter.xml
BOOK/final-system/sparc-chapter.xml
BOOK/final-system/sparc64-64-chapter.xml
BOOK/final-system/sparc64-chapter.xml
BOOK/final-system/x86-chapter.xml
BOOK/final-system/x86_64-64-chapter.xml
BOOK/final-system/x86_64-chapter.xml
BOOK/introduction/common/changelog.xml
BOOK/materials/common/packages.xml
BOOK/packages.ent

  • Property mode set to 100644
File size: 6.3 KB
RevLine 
[73e1db21]1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="ch-scripts-locale">
9 <title>Setting Up Locale Information</title>
10 <?dbhtml filename="locale.html"?>
11
12 <indexterm zone="ch-scripts-locale">
[2164942]13 <primary sortas="e-/etc/locale.conf">/etc/locale.conf</primary>
[73e1db21]14 </indexterm>
15
[2164942]16 <para>The file <filename>/etc/locale.conf</filename> file configures
17 system-wide locale settings. The basic file format of locale.conf is a
18 newline-separated list of variable assignments. It is possible to source this
19 configuration file from shell scripts, but it should never contain any shell
20 script features beyond variable assignments. The
21 <filename>locale.conf</filename> man page contains information about the
22 function of this file. Setting up this file properly results in:</para>
[73e1db21]23
24 <itemizedlist>
25 <listitem>
26 <para>The output of programs translated into the native language</para>
27 </listitem>
28 <listitem>
29 <para>Correct classification of characters into letters, digits and
30 other classes. This is necessary for <command>bash</command> to
31 properly accept non-ASCII characters in command lines in non-English
32 locales</para>
33 </listitem>
34 <listitem>
35 <para>The correct alphabetical sorting order for the country</para>
36 </listitem>
37 <listitem>
38 <para>Appropriate default paper size</para>
39 </listitem>
40 <listitem>
41 <para>Correct formatting of monetary, time, and date values</para>
42 </listitem>
43 </itemizedlist>
44
45 <para>Replace <replaceable>[ll]</replaceable> below with the
46 two-letter code for the desired language (e.g., <quote>en</quote>) and
47 <replaceable>[CC]</replaceable> with the two-letter code for the
[2164942]48 appropriate country (e.g., <quote>GB</quote> or <quote>US</quote>).
[73e1db21]49 <replaceable>[charmap]</replaceable> should be replaced with the
50 canonical charmap for your chosen locale.</para>
51
52 <para>The list of all locales supported by Glibc can be obtained by running
53 the following command:</para>
54
55<screen role="nodump"><userinput>locale -a</userinput></screen>
56
57 <para>Locales can have a number of synonyms, e.g. <quote>ISO-8859-1</quote>
58 is also referred to as <quote>iso8859-1</quote> and <quote>iso88591</quote>.
59 Some applications cannot handle the various synonyms correctly, so it is
60 safest to choose the canonical name for a particular locale. To determine
61 the canonical name, run the following command, where <replaceable>[locale
62 name]</replaceable> is the output given by <command>locale -a</command> for
63 your preferred locale (<quote>en_US.utf8</quote> in our example).</para>
64
65<screen role="nodump"><userinput>LC_ALL=<replaceable>[locale name]</replaceable> locale charmap</userinput></screen>
66
67 <para>For the <quote>en_US.utf8</quote> locale, the above command
68 will print:</para>
69
70<screen><computeroutput>UTF-8</computeroutput></screen>
71
72 <para>This results in a final locale setting of <quote>en_US.UTF-8</quote>.
73 It is important that the locale found using the heuristic above is tested prior
[2164942]74 to it being added to <filename>/etc/locale.conf</filename>:</para>
[73e1db21]75
[5b3e31fd]76<screen role="nodump"><userinput>LC_ALL=[locale name] locale territory
[73e1db21]77LC_ALL=[locale name] locale language
78LC_ALL=[locale name] locale charmap
79LC_ALL=[locale name] locale int_curr_symbol
80LC_ALL=[locale name] locale int_prefix</userinput></screen>
81
82 <para>The above commands should print the language name, the character
83 encoding used by the locale, the local currency, and the prefix to dial
84 before the telephone number in order to get into the country. If any of the
85 commands above fail with a message similar to the one shown below, this means
86 that your locale was either not installed in Chapter 10 or is not supported by
87 the default installation of Glibc.</para>
88
89<screen><computeroutput>locale: Cannot set LC_* to default locale: No such file or directory</computeroutput></screen>
90
91 <para>If this happens, you should either install the desired locale using
92 the <command>localedef</command> command, or consider choosing a different
93 locale. Further instructions assume that there are no such error messages
94 from Glibc.</para>
95
96 <para>Some packages beyond CLFS may also lack support for your chosen locale.
97 One example is the X library (part of the X Window System), which outputs
98 the following error message:</para>
99
100<screen><computeroutput>Warning: locale not supported by Xlib, locale set to C</computeroutput></screen>
101
102 <para>Sometimes it is possible to fix this by removing the charmap part of
103 the locale specification, as long as that does not change the character map
104 that Glibc associates with the locale (this can be checked by running the
105 <command>locale charmap</command> command in both locales). For example,
106 one would have to change &quot;de_DE.ISO-8859-15@euro&quot; to
107 &quot;de_DE@euro&quot; in order to get this locale recognized by Xlib.</para>
108
109 <para>Other packages can also function incorrectly (but may not necessarily
110 display any error messages) if the locale name does not meet their expectations.
111 In those cases, investigating how other Linux distributions support your locale
112 might provide some useful information.</para>
113
114 <para>Once the proper locale settings have been determined, create the
[2164942]115 <filename>/etc/locale.conf</filename> file:</para>
[73e1db21]116
[2164942]117<screen><userinput>cat &gt; /etc/locale.conf &lt;&lt; "EOF"
118<literal># Begin /etc/locale.conf
[73e1db21]119
[2164942]120LANG=<replaceable>[ll]</replaceable>_<replaceable>[CC]</replaceable>.<replaceable>[charmap]</replaceable>
[73e1db21]121
[2164942]122# End /etc/locale.conf</literal>
[73e1db21]123EOF</userinput></screen>
124
125 <para>Setting the keyboard layout, screen font, and locale-related
126 environment variables are the only internationalization steps needed to
127 support locales that use ordinary single-byte encodings and left-to-right
[9c06d27e]128 writing direction. UTF-8 has been tested on the English, French, German,
[73e1db21]129 Italian, and Spanish locales. All other locales are untested. If you discover
[9c06d27e]130 issues with any other locale please open a ticket in our Trac system.</para>
[73e1db21]131
[9c06d27e]132 <para>Some locales need additional programs and support. CLFS will not be
133 supporting these locales in the book. We welcome the support for these other
134 locales via <ulink url="&cblfs-root;"/>.</para>
[73e1db21]135
136</sect1>
Note: See TracBrowser for help on using the repository browser.