/[gentoo]/xml/htdocs/doc/en/guide-localization.xml
Gentoo

Contents of /xml/htdocs/doc/en/guide-localization.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.49 - (hide annotations) (download) (as text)
Fri Oct 10 16:03:49 2008 UTC (5 years, 9 months ago) by jkt
Branch: MAIN
Changes since 1.48: +41 -25 lines
File MIME type: application/xml
#208082: don't use LC_ALL, prefer system-wide LANG, don't set LC_CTYPE when LANG
is already set, advertise utf-8 a bit more...

1 swift 1.6 <?xml version='1.0' encoding='UTF-8'?>
2 jkt 1.49 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/guide-localization.xml,v 1.48 2007/10/04 20:19:59 neysx Exp $ -->
3 swift 1.6 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
4    
5     <guide link="/doc/en/guide-localization.xml">
6 antifa 1.4 <title>Gentoo Linux Localization Guide</title>
7 dertobi123 1.12 <author title="Author">
8 pylon 1.16 Alexander Holler
9 drobbins 1.1 </author>
10 dertobi123 1.12 <author title="Translator/Editor">
11     <mail link="slucy@uchicago.edu">Steven Lucy</mail>
12 antifa 1.4 </author>
13 bennyc 1.8 <author title="Editor">
14     <mail link="bennyc@gentoo.org">Benny Chuang</mail>
15     </author>
16 dertobi123 1.11 <author title="Editor">
17     <mail link="pylon@gentoo.org">Lars Weiler</mail>
18     </author>
19 dertobi123 1.15 <author title="Editor">
20     <mail link="dertobi123@gentoo.org">Tobias Scherbaum</mail>
21     </author>
22 swift 1.18 <author title="Editor">
23     <mail link="flammie@gentoo.org">Flammie Pirinen</mail>
24     </author>
25 dertobi123 1.12
26 antifa 1.4 <abstract>
27     This guide should help users localize their Gentoo Linux distribution to any
28 dertobi123 1.12 European locale. It uses Germany as a case-study, since it is translated from
29 swift 1.23 the German doc. Includes configuration for use of the euro currency symbol.
30 antifa 1.4 </abstract>
31 drobbins 1.1
32 jkt 1.49 <version>1.37</version>
33     <date>2008-10-10</date>
34 dertobi123 1.12
35 drobbins 1.1 <chapter>
36 swift 1.23 <title>Time zone</title>
37 drobbins 1.1 <section>
38 dertobi123 1.12 <body>
39    
40     <p>
41 nightmorph 1.46 In order to keep time properly, you need to select your timezone so that your
42     system knows where it is located. Look for your timezone in
43     <path>/usr/share/zoneinfo</path>. You then set your timezone in
44     <path>/etc/conf.d/clock</path>. Please avoid the
45 neysx 1.31 <path>/usr/share/zoneinfo/Etc/GMT*</path> timezones as their names do not
46     indicate the expected zones. For instance, <path>GMT-8</path> is in fact GMT+8.
47 dertobi123 1.12 </p>
48    
49 nightmorph 1.46 <pre caption="Setting the timezone information">
50     # <i>ls /usr/share/zoneinfo</i>
51     <comment>(Suppose you want to use Brussels)</comment>
52     # <i>nano -w /etc/conf.d/clock</i>
53     TIMEZONE="Europe/Brussels"
54    
55 antifa 1.4 # <i>date</i>
56 nightmorph 1.46 Wed Mar 8 00:46:05 CET 2006
57 drobbins 1.1 </pre>
58 dertobi123 1.12
59     <note>
60 flammie 1.41 Make sure that the timezone indicator (in this case "CET")
61 dertobi123 1.12 is correct for your area.
62     </note>
63    
64     <note>
65 cam 1.13 You can set the value of <c>TZ</c> to be everything after the
66 aaby 1.10 <path>/usr/share/zoneinfo</path> in your shell rc file
67 antifa 1.4 (<path>.bash_profile</path> for bash) for a user-level setting. In this case
68 cam 1.13 <c>TZ="Europe/Berlin"</c>.
69 dertobi123 1.12 </note>
70    
71     </body>
72 drobbins 1.1 </section>
73     </chapter>
74    
75     <chapter>
76 swift 1.26 <title>Hardware Clock</title>
77 drobbins 1.1 <section>
78 dertobi123 1.12 <body>
79    
80     <p>
81 swift 1.26 In most Gentoo Linux installations, your hardware clock is set to
82 swift 1.23 UTC (or GMT, Greenwich Mean Time) and then your timezone is
83 dertobi123 1.12 taken into account to determine the actual, local time. If,
84 swift 1.26 for some reason, you need your hardware clock not to be in UTC,
85 fox2mike 1.28 you will need to edit <path>/etc/conf.d/clock</path> and change the
86 swift 1.26 value of <c>CLOCK</c> from <c>UTC</c> to <c>local</c>.
87 dertobi123 1.12 </p>
88 antifa 1.4
89     <pre caption="local vs. GMT clock">
90 neysx 1.20 <comment>(recommended:)</comment>
91 dertobi123 1.12 CLOCK="UTC"
92 neysx 1.20 <comment>(or:)</comment>
93 dertobi123 1.12 CLOCK="local"
94 drobbins 1.1 </pre>
95 dertobi123 1.12
96     </body>
97 drobbins 1.1 </section>
98     </chapter>
99    
100     <chapter>
101 swift 1.18 <title>Locale system</title>
102 drobbins 1.1 <section>
103 swift 1.18 <title>What are locales?</title>
104 dertobi123 1.12 <body>
105    
106     <p>
107 neysx 1.48 A Locale is a set of information that most programs use for determining country
108     and language specific settings. The locales and their data are part of the
109     system library and can be found at <path>/usr/share/locale</path> on most
110     systems. A locale name is generally named <c>ab_CD</c> where <c>ab</c> is your
111     two (or three) letter language code (as specified in ISO-639) and <c>CD</c> is
112     your two letter country code (as specified in ISO-3166). Variants are often
113     appended to locale names, e.g. <c>en_GB.utf8</c> or <c>de_DE@euro</c>. Please
114     explore <uri link="http://en.wikipedia.org/wiki/Locale">Wikipedia</uri> to read
115     more about locales and related articles.
116 swift 1.18 </p>
117    
118     </body>
119     </section>
120 flammie 1.32 <section id="variables">
121 swift 1.18 <title>Environment variables for locales</title>
122     <body>
123    
124     <p>
125     Locale settings are stored in environment variables. These are typically
126     set in the <path>/etc/env.d/02locale</path> (for system-wide
127     settings) and <path>~/.bashrc</path> (for user-specific settings) file.
128     The variables controlling different aspects of locale settings
129 flammie 1.42 are given in the table below, those with highest precedence (i.e. those
130 swift 1.18 that override settings below them) are at the top of the table. All variables
131     take one name of a locale in <c>ab_CD</c> format given above.
132     </p>
133    
134     <table>
135     <tr>
136     <th>Variable name</th>
137     <th>Explanation</th>
138     </tr>
139     <tr>
140 jkt 1.49 <ti>LANG</ti>
141 swift 1.18 <ti>
142 jkt 1.49 Defines all locale settings at once, while allowing further individual
143     customization via the LC_* settings below.
144 swift 1.18 </ti>
145     </tr>
146     <tr>
147     <ti>LC_COLLATE</ti>
148     <ti>
149 flammie 1.42 Define alphabetical ordering of strings. This affects e.g. output of sorted
150 swift 1.23 directory listing.
151 swift 1.18 </ti>
152     </tr>
153     <tr>
154     <ti>LC_CTYPE</ti>
155     <ti>
156     Define the character handling properties for the system. This determines
157     which characters are seen as part of alphabet, numeric and so on. This also
158     determines the character set used, if applicable.
159     </ti>
160     </tr>
161     <tr>
162     <ti>LC_MESSAGES</ti>
163     <ti>
164     Programs' localizations for applications that use message based localization
165     scheme (majority of Gnu programs, see next chapters for closer information
166     which do, and how to get the programs, that don't, to work).
167     </ti>
168     </tr>
169     <tr>
170     <ti>LC_MONETARY</ti>
171     <ti>Defines currency units and formatting of currency type numeric values.</ti>
172     </tr>
173     <tr>
174     <ti>LC_NUMERIC</ti>
175     <ti>
176     Defines formatting of numeric values which aren't monetary. Affects things
177     such as thousand separator and decimal separator.
178     </ti>
179     </tr>
180     <tr>
181     <ti>LC_TIME</ti>
182     <ti>Defines formatting of dates and times.</ti>
183     </tr>
184     <tr>
185     <ti>LC_PAPER</ti>
186     <ti>Defines default paper size.</ti>
187     </tr>
188     <tr>
189 jkt 1.49 <ti>LC_ALL</ti>
190 swift 1.18 <ti>
191 jkt 1.49 A special variable for overriding all other settings.
192 swift 1.18 </ti>
193     </tr>
194     </table>
195    
196 swift 1.25 <note>
197 jkt 1.49 Some programs are written in such a way that they expect traditional English
198     ordering of the alphabet, while some locales, most notably the Estonian one, use
199     a different ordering. Therefore it's recommended to explicitly set LC_COLLATE to C
200     when dealing with system-wide settings.
201 swift 1.25 </note>
202    
203 jkt 1.49 <warn>
204     For the same reason, using LC_ALL is strongly discouraged. Please use it only
205     when testing and never set it in a startup file.
206     </warn>
207    
208 swift 1.18 <p>
209 jkt 1.49 Most typically users only set the LANG variable on the global basis:
210 dertobi123 1.12 </p>
211    
212 jkt 1.49 <pre caption="Setting the default system locale in /etc/env.d/02locale">
213     LANG="de_DE.utf8@euro"
214     LC_COLLATE="C"
215 drobbins 1.1 </pre>
216 dertobi123 1.12
217     <note>
218 swift 1.18 Append <c>@euro</c> to your locale if you want to use the Euro
219 neysx 1.39 currency symbol (€)
220 dertobi123 1.12 </note>
221    
222 swift 1.18 <p>
223 jkt 1.49 It's also possible, and pretty common especially in a more traditional UNIX
224     environment, to leave the global settings unchanged, i.e. in the "<c>C</c>"
225     locale. Users can still specify their preferred locale in their own shell RC
226     file:
227 neysx 1.39 </p>
228    
229 jkt 1.49 <pre caption="Setting the user locale in ~/.bashrc">
230     export LANG="de_DE.utf8@euro"
231     export LC_COLLATE="C"
232     </pre>
233    
234     <p>
235     Another way of configuring system is to leave it in the default C locale, but
236     enable UTF-8 character representation at the same time. This option is achieved
237     using the following settings in <path>/etc/env.d/02locale</path>:
238     </p>
239    
240     <pre caption="Using traditional C locale while specifying UTF-8">
241     LC_CTYPE=de_DE.utf8
242 neysx 1.39 </pre>
243    
244     <p>
245 jkt 1.49 Using the above snippet, users will be able to see localized file names
246     properly, while not being forced to your preferred language.
247 neysx 1.39 </p>
248    
249     <p>
250 swift 1.18 For message based localization to work in programs that support it, you will
251     probably need to have programs compiled with the <c>nls</c> (Native language
252     support) USE flag set. Most of the programs using nls also need the gettext
253 neysx 1.39 library to extract and use localized messages. Of course, Portage will
254 swift 1.18 automatically install it when needed.
255     </p>
256    
257 flammie 1.32 <p>
258 rane 1.35 Once you have set the right locale, be sure to update your environment
259     variables to make your system aware of the change:
260     </p>
261    
262     <pre caption="Update the environment">
263 neysx 1.39 <comment>(For system-wide default locale:)</comment>
264 rane 1.35 # <i>env-update &amp;&amp; source /etc/profile</i>
265 neysx 1.39
266 jkt 1.40 <comment>(For user-specific locale:)</comment>
267 neysx 1.39 $ <i>source ~/.bashrc</i>
268 rane 1.35 </pre>
269    
270     <p>
271     After this, you will need to kill your X server by pressing
272     <c>Ctrl-Alt-Backspace</c>, log out, then log in as user.
273     </p>
274    
275     <p>
276     Now, verify that the changes have taken effect:
277     </p>
278    
279     <pre caption="Verify env changes">
280 jkt 1.49 $ <i>locale</i>
281 rane 1.35 </pre>
282    
283     <p>
284 flammie 1.32 There is also additional localisation variable called LINGUAS, which affects
285     to localisation files that get installed in gettext-based programs, and decides
286     used localisation for some specific software packages, such as
287     <c>kde-base/kde-i18n</c> and <c>app-office/openoffice</c>. The variable
288     takes in <e>space</e>-separated list of language codes, and suggested
289     place to set it is <path>/etc/make.conf</path>:
290     </p>
291    
292 neysx 1.39 <pre caption="Setting LINGUAS in make.conf">
293 flammie 1.32 # <i>nano -w /etc/make.conf</i>
294     <comment>(Add in the LINGUAS variable. For instance,
295     for German, Finnish and English:)</comment>
296     LINGUAS="de fi en"
297     </pre>
298    
299    
300 dertobi123 1.12 </body>
301 drobbins 1.1 </section>
302 swift 1.14 <section>
303     <title>Generating Specific Locales</title>
304     <body>
305    
306     <p>
307     If you use a locale that isn't available by default, you should use
308     <c>localedef</c> to generate your locale. For instance:
309     </p>
310    
311     <pre caption="Generating a locale using localedef">
312     # <i>localedef -c -i en_US -f ISO-8859-15 en_US.ISO-8859-15</i>
313     </pre>
314    
315     <p>
316     After having generated the locale, you can export the LANG variable as you see
317     fit.
318     </p>
319    
320     <pre caption="Exporting the LANG variable">
321     # <i>export LANG="en_US.ISO-8859-15"</i>
322     </pre>
323    
324 rane 1.35 <p>
325     Be sure to update the environment after the change:
326     </p>
327    
328     <pre caption="Update the environment">
329     # <i>env-update &amp;&amp; source /etc/profile</i>
330     </pre>
331    
332     <p>
333     After this, you will need to kill your X server by pressing
334     <c>Ctrl-Alt-Backspace</c>, log out, then log in as user.
335     </p>
336    
337 swift 1.14 </body>
338     </section>
339 dertobi123 1.15 <section>
340 rane 1.43 <title>Generating locales for glibc</title>
341 dertobi123 1.15 <body>
342    
343     <p>
344 rane 1.43 You will probably only use one or maybe two locales on your system. You can
345     specify locales you will need in <path>/etc/locale.gen</path>.
346 dertobi123 1.15 </p>
347    
348 rane 1.43 <pre caption="Adding locales to /etc/locale.gen">
349     en_GB ISO-8859-1
350     en_GB.UTF-8 UTF-8
351     de_DE ISO-8859-1
352     de_DE@euro ISO-8859-15
353 dertobi123 1.15 </pre>
354    
355     <p>
356 rane 1.43 The next step is to run <c>locale-gen</c>. It will generate all the locales you
357     have specified in the <path>/etc/locale.gen</path> file.
358 dertobi123 1.15 </p>
359    
360 rane 1.43 <note>
361     <c>locale-gen</c> is available in <c>glibc-2.3.6-r4</c> and newer. If you have
362     an older version of glibc, you should update it now.
363     </note>
364 dertobi123 1.15
365 nightmorph 1.44 <p>
366     You can verify that your selected locales are available by running <c>locale
367     -a</c>.
368     </p>
369    
370 dertobi123 1.15 </body>
371     </section>
372 drobbins 1.1 </chapter>
373    
374     <chapter>
375 antifa 1.4 <title>Keyboard layout for the console</title>
376 drobbins 1.1 <section>
377 dertobi123 1.12 <body>
378    
379     <p>
380     The keyboard layout used by the console is set in
381 fox2mike 1.27 <path>/etc/conf.d/keymaps</path> by the <c>KEYMAP</c> variable.
382 dertobi123 1.12 Valid values can be found in
383 cam 1.13 <path>/usr/share/keymaps/<c>{arch}</c>/</path>.
384 dertobi123 1.12 <path>i386</path> has further subdivisions into layout
385     (<path>qwerty/</path>, <path>azerty/</path>, etc.). Some
386     languages have multiple options, so you may wish to experiment
387     to decide which one fits your needs best.
388     </p>
389    
390 neysx 1.39 <pre caption="Setting the console keymap">
391 dertobi123 1.12 KEYMAP="de"
392     KEYMAP="de-latin1"
393     KEYMAP="de-latin1-nodeadkeys"
394 drobbins 1.1 </pre>
395 dertobi123 1.12
396     </body>
397 drobbins 1.1 </section>
398     </chapter>
399    
400     <chapter>
401 antifa 1.4 <title>Keyboard layout for the X server</title>
402 drobbins 1.1 <section>
403 dertobi123 1.12 <body>
404    
405     <p>
406     The keyboard layout to be used by the X server is specified
407 alin 1.21 in <path>/etc/X11/xorg.conf</path> by the <c>XkbLayout</c>
408 dertobi123 1.12 option.
409     </p>
410    
411 neysx 1.39 <pre caption="Setting the X keymap">
412 drobbins 1.1 Section "InputDevice"
413     Identifier "Keyboard1"
414     ...
415     Option "XkbLayout" "de"
416 rane 1.35 #Option "XkbModel" "pc105" <comment>## this is for international keyboards.</comment>
417     # Option "XkbVariant" "nodeadkeys" <comment>## this would be used for xterm input</comment>
418     ...
419     </pre>
420    
421     <p>
422     If you have an international keyboard layout, you should set the option
423     <c>XkbModel</c> to <c>pc102</c> or <c>pc105</c>, as this will allow mapping of the
424     additional keys specific to your keyboard.
425     </p>
426    
427     <p>
428     Deadkeys allow you to press keys that will not show immediately but will be
429     combined with another letter to produce a single character such as é,è,á,à,
430     etc. Setting <c>XkbVariant</c> to <c>nodeadkeys</c> allows input these special
431     characters into X terminals.
432     </p>
433    
434     <p>
435     If you would like to switch between more than one keyboard layout (for example
436     English and Russian), all you have to do is add a few lines to
437     <path>xorg.conf</path> that specify the desired layouts and the shortcut
438     command.
439     </p>
440    
441     <pre caption="Switching between two keyboard layouts">
442     Section "InputDevice"
443     Identifier "Keyboard1"
444 drobbins 1.1 ...
445 rane 1.35 Option "XkbLayout" "us,ru"
446     Option "XkbOptions" "grp:alt_shift_toggle,grp_led:scroll"
447 drobbins 1.1 </pre>
448 dertobi123 1.12
449 rane 1.35 <p>
450     Here, <c>XkbOptions</c> allows you to toggle between keyboard layouts by simply
451     pressing <c>Alt-Shift</c>. This will also toggle the Scroll Lock light on or
452     off, thanks to the <c>grp_led:scroll</c> option. This is a handy visual
453     indicator of which keyboard layout you are using at the moment.
454     </p>
455    
456 dertobi123 1.12 </body>
457 drobbins 1.1 </section>
458     </chapter>
459    
460     <chapter>
461 dertobi123 1.11 <title>KDE</title>
462     <section>
463     <body>
464    
465     <p>
466 flammie 1.32 For KDE you have to install the <c>kde-base/kde-i18n</c> package. Kde-i18n
467     respects <uri link="#variables">LINGUAS variable</uri> described earlier.
468 swift 1.22 </p>
469 dertobi123 1.11
470     </body>
471     </section>
472     </chapter>
473    
474     <chapter>
475 antifa 1.4 <title>The Euro Symbol for the Console</title>
476 drobbins 1.1 <section>
477 dertobi123 1.12 <body>
478    
479     <p>
480     In order to get your console to display the Euro symbol, you
481 cam 1.13 will need to set <c>CONSOLEFONT</c> in
482 rane 1.35 <path>/etc/conf.d/consolefont</path> to a file found in
483 dertobi123 1.12 <path>/usr/share/consolefonts/</path> (without the
484     <c>.psfu.gz</c>). <c>lat9w-16</c> has the Euro symbol.
485     </p>
486    
487 neysx 1.39 <pre caption="Setting the console font">
488 dertobi123 1.12 CONSOLEFONT="lat9w-16"
489 drobbins 1.1 </pre>
490 dertobi123 1.12
491 rane 1.35 <p>
492     You should verify that <c>CONSOLEFONT</c> is in the boot runlevel:
493     </p>
494    
495     <pre caption="Verify the proper runlevel">
496 nightmorph 1.47 # <i>rc-update -v show | grep -i consolefont</i>
497 rane 1.35 </pre>
498    
499     <p>
500     If no runlevel is displayed for <c>CONSOLEFONT</c>, then add it to the proper level:
501     </p>
502    
503     <pre caption="Add consolefont to boot">
504     # <i>rc-update add consolefont boot</i>
505     </pre>
506    
507 dertobi123 1.12 </body>
508 drobbins 1.1 </section>
509     </chapter>
510    
511     <chapter>
512 dertobi123 1.12 <title>The Euro Symbol in X</title>
513 drobbins 1.1 <section>
514 dertobi123 1.12 <title>Most Applications</title>
515     <body>
516    
517     <p>
518 nightmorph 1.45 Getting the Euro symbol to work properly in X is a little bit tougher. The
519     first thing you should do is change the <c>fixed</c> and <c>variable</c>
520     definitions in <path>/usr/share/fonts/misc/fonts.alias</path> to end in
521     <c>iso8859-15</c> instead of <c>iso8859-1</c>.
522 dertobi123 1.12 </p>
523    
524 neysx 1.39 <pre caption="Setting default X fonts">
525 dertobi123 1.12 fixed -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-15
526     variable -*-helvetica-bold-r-normal-*-*-120-*-*-*-*-iso8859-15
527 antifa 1.4 </pre>
528 dertobi123 1.12
529     <p>
530 nightmorph 1.45 Some applications use their own font, and you will have to tell them separately
531     to use a font with the Euro symbol. You can do this at a user-specific level in
532     <path>.Xdefaults</path> (you can copy this file to <path>/etc/skel/</path> for
533     use by new users), or at a global level for any application with a resource file
534     in <path>/usr/share/X11/app-defaults/</path> (like xterm). In these files you
535     generally have to change an existing line, rather than adding a new one. To
536     change our xterm font, for instance:
537 dertobi123 1.12 </p>
538    
539 neysx 1.39 <pre caption="Setting fonts for xterm">
540 neysx 1.20 <comment>(in your home directory)</comment>
541 nightmorph 1.38 $ <i>echo 'XTerm*font: fixed' >> .Xresources </i>
542     $ <i>xrdb -merge .Xresources</i>
543 drobbins 1.1 </pre>
544 dertobi123 1.12
545     </body>
546 drobbins 1.1 </section>
547 dertobi123 1.12 <section>
548     <title>The Euro symbol in (X)Emacs</title>
549     <body>
550    
551     <p>
552     To use the Euro symbol in (X)Emacs, add the following to
553     <path>.Xdefaults</path>:
554     </p>
555 drobbins 1.1
556 antifa 1.4 <pre caption="setting the font for emacs">
557 dertobi123 1.12 Emacs.default.attributeFont: -*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-15
558 drobbins 1.1 </pre>
559 dertobi123 1.12
560     <p>
561     For XEmacs (not plain Emacs), you have to do a little
562     more. In <path>/home/user/.xemacs/init.el</path>, add:
563     </p>
564    
565 antifa 1.4 <pre caption="setting the font for xemacs">
566 neysx 1.39 (define-key global-map '(EuroSign) '[€])
567 drobbins 1.1 </pre>
568 dertobi123 1.12
569     <note>
570     The symbol in the []s is the Euro symbol.
571     </note>
572    
573     </body>
574     </section>
575     <section>
576 flammie 1.32 <title>OpenOffice.Org</title>
577 dertobi123 1.12 <body>
578    
579     <p>
580 nightmorph 1.36 The current stable <c>app-office/openoffice</c> and
581     <c>app-office/openoffice-bin</c> ebuilds support the <uri
582     link="#variables">LINGUAS variable</uri> for selecting installed GUI language
583     packs. To see the status of GUI translation, hyphenation, spell checking and
584     other localisations on your language, please refer to <uri
585     link="http://l10n.openoffice.org/languages.html">OpenOffice.Org localisation
586     web site</uri>.
587 dertobi123 1.12 </p>
588    
589     </body>
590 bennyc 1.8 </section>
591 drobbins 1.1 </chapter>
592    
593     </guide>

  ViewVC Help
Powered by ViewVC 1.1.20