/[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.46 - (hide annotations) (download) (as text)
Mon May 7 18:11:40 2007 UTC (7 years, 7 months ago) by nightmorph
Branch: MAIN
Changes since 1.45: +14 -9 lines
File MIME type: application/xml
2007.0 release is here; final changes and new docs

1 swift 1.6 <?xml version='1.0' encoding='UTF-8'?>
2 nightmorph 1.46 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/guide-localization.xml,v 1.45 2006/11/10 21:24:14 nightmorph 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 nightmorph 1.46 <version>1.34</version>
33     <date>2007-05-07</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 swift 1.18 A Locale is a set of information that most programs use for determining
108     country and language specific settings. The locales and their data
109     are part of the system library and can be found
110     at <path>/usr/share/locale</path> on most systems. A locale name is generally
111 swift 1.25 named <c>ab_CD</c> where <c>ab</c> is your two (or three) letter
112 swift 1.18 language code (as specified in ISO-639) and <c>CD</c> is your two letter country
113 nightmorph 1.37 code (as specified in ISO-3166).
114 swift 1.18 </p>
115    
116     </body>
117     </section>
118 flammie 1.32 <section id="variables">
119 swift 1.18 <title>Environment variables for locales</title>
120     <body>
121    
122     <p>
123     Locale settings are stored in environment variables. These are typically
124     set in the <path>/etc/env.d/02locale</path> (for system-wide
125     settings) and <path>~/.bashrc</path> (for user-specific settings) file.
126     The variables controlling different aspects of locale settings
127 flammie 1.42 are given in the table below, those with highest precedence (i.e. those
128 swift 1.18 that override settings below them) are at the top of the table. All variables
129     take one name of a locale in <c>ab_CD</c> format given above.
130     </p>
131    
132     <table>
133     <tr>
134     <th>Variable name</th>
135     <th>Explanation</th>
136     </tr>
137     <tr>
138     <ti>LC_ALL</ti>
139     <ti>
140     Define all locale settings at once. This is the top level setting for
141     locales which will override any other setting.
142     </ti>
143     </tr>
144     <tr>
145     <ti>LC_COLLATE</ti>
146     <ti>
147 flammie 1.42 Define alphabetical ordering of strings. This affects e.g. output of sorted
148 swift 1.23 directory listing.
149 swift 1.18 </ti>
150     </tr>
151     <tr>
152     <ti>LC_CTYPE</ti>
153     <ti>
154     Define the character handling properties for the system. This determines
155     which characters are seen as part of alphabet, numeric and so on. This also
156     determines the character set used, if applicable.
157     </ti>
158     </tr>
159     <tr>
160     <ti>LC_MESSAGES</ti>
161     <ti>
162     Programs' localizations for applications that use message based localization
163     scheme (majority of Gnu programs, see next chapters for closer information
164     which do, and how to get the programs, that don't, to work).
165     </ti>
166     </tr>
167     <tr>
168     <ti>LC_MONETARY</ti>
169     <ti>Defines currency units and formatting of currency type numeric values.</ti>
170     </tr>
171     <tr>
172     <ti>LC_NUMERIC</ti>
173     <ti>
174     Defines formatting of numeric values which aren't monetary. Affects things
175     such as thousand separator and decimal separator.
176     </ti>
177     </tr>
178     <tr>
179     <ti>LC_TIME</ti>
180     <ti>Defines formatting of dates and times.</ti>
181     </tr>
182     <tr>
183     <ti>LC_PAPER</ti>
184     <ti>Defines default paper size.</ti>
185     </tr>
186     <tr>
187     <ti>LANG</ti>
188     <ti>
189     Defines all locale settings at once. This setting can be overridden by
190     individual LC_* settings above or even by LC_ALL.
191     </ti>
192     </tr>
193     </table>
194    
195 swift 1.25 <note>
196     Even though most programs work with LC_ALL only, some of them misbehave if
197     LC_ALL is set but LANG isn't. If you want to play safe, set them <e>both</e>.
198     </note>
199    
200 swift 1.18 <p>
201     Most typically users only set the LANG variable and perhaps LC_CTYPE variable
202     on user level by adding definitions to shells startup files defining
203     the environment variable manually from command line:
204 dertobi123 1.12 </p>
205    
206 neysx 1.39 <pre caption="Setting the user locale in ~/.bashrc">
207 dertobi123 1.12 export LANG="de_DE@euro"
208 drobbins 1.1 </pre>
209 dertobi123 1.12
210     <note>
211 swift 1.18 Append <c>@euro</c> to your locale if you want to use the Euro
212 neysx 1.39 currency symbol (€)
213 dertobi123 1.12 </note>
214    
215 swift 1.18 <p>
216 neysx 1.39 It is also possible to set a system-wide locale for all users and programs:
217     </p>
218    
219     <pre caption="Setting the default system locale in /etc/env.d/02locale">
220     LC_ALL="de_DE@euro"
221     LANG="de_DE@euro"
222     </pre>
223    
224     <p>
225     A common practice is to use only per user locale settings and leave the
226     default system locale unset. In this case system locale defaults to a
227     special value <c>"C"</c>, which for historical reasons maps to the English
228     locale.
229     </p>
230    
231     <p>
232 swift 1.18 For message based localization to work in programs that support it, you will
233     probably need to have programs compiled with the <c>nls</c> (Native language
234     support) USE flag set. Most of the programs using nls also need the gettext
235 neysx 1.39 library to extract and use localized messages. Of course, Portage will
236 swift 1.18 automatically install it when needed.
237     </p>
238    
239 flammie 1.32 <p>
240 rane 1.35 Once you have set the right locale, be sure to update your environment
241     variables to make your system aware of the change:
242     </p>
243    
244     <pre caption="Update the environment">
245 neysx 1.39 <comment>(For system-wide default locale:)</comment>
246 rane 1.35 # <i>env-update &amp;&amp; source /etc/profile</i>
247 neysx 1.39
248 jkt 1.40 <comment>(For user-specific locale:)</comment>
249 neysx 1.39 $ <i>source ~/.bashrc</i>
250 rane 1.35 </pre>
251    
252     <p>
253     After this, you will need to kill your X server by pressing
254     <c>Ctrl-Alt-Backspace</c>, log out, then log in as user.
255     </p>
256    
257     <p>
258     Now, verify that the changes have taken effect:
259     </p>
260    
261     <pre caption="Verify env changes">
262     $ <i>env | grep -i LC_</i>
263     </pre>
264    
265     <p>
266 flammie 1.32 There is also additional localisation variable called LINGUAS, which affects
267     to localisation files that get installed in gettext-based programs, and decides
268     used localisation for some specific software packages, such as
269     <c>kde-base/kde-i18n</c> and <c>app-office/openoffice</c>. The variable
270     takes in <e>space</e>-separated list of language codes, and suggested
271     place to set it is <path>/etc/make.conf</path>:
272     </p>
273    
274 neysx 1.39 <pre caption="Setting LINGUAS in make.conf">
275 flammie 1.32 # <i>nano -w /etc/make.conf</i>
276     <comment>(Add in the LINGUAS variable. For instance,
277     for German, Finnish and English:)</comment>
278     LINGUAS="de fi en"
279     </pre>
280    
281    
282 dertobi123 1.12 </body>
283 drobbins 1.1 </section>
284 swift 1.14 <section>
285     <title>Generating Specific Locales</title>
286     <body>
287    
288     <p>
289     If you use a locale that isn't available by default, you should use
290     <c>localedef</c> to generate your locale. For instance:
291     </p>
292    
293     <pre caption="Generating a locale using localedef">
294     # <i>localedef -c -i en_US -f ISO-8859-15 en_US.ISO-8859-15</i>
295     </pre>
296    
297     <p>
298     After having generated the locale, you can export the LANG variable as you see
299     fit.
300     </p>
301    
302     <pre caption="Exporting the LANG variable">
303     # <i>export LANG="en_US.ISO-8859-15"</i>
304     </pre>
305    
306 rane 1.35 <p>
307     Be sure to update the environment after the change:
308     </p>
309    
310     <pre caption="Update the environment">
311     # <i>env-update &amp;&amp; source /etc/profile</i>
312     </pre>
313    
314     <p>
315     After this, you will need to kill your X server by pressing
316     <c>Ctrl-Alt-Backspace</c>, log out, then log in as user.
317     </p>
318    
319 swift 1.14 </body>
320     </section>
321 dertobi123 1.15 <section>
322 rane 1.43 <title>Generating locales for glibc</title>
323 dertobi123 1.15 <body>
324    
325     <p>
326 rane 1.43 You will probably only use one or maybe two locales on your system. You can
327     specify locales you will need in <path>/etc/locale.gen</path>.
328 dertobi123 1.15 </p>
329    
330 rane 1.43 <pre caption="Adding locales to /etc/locale.gen">
331     en_GB ISO-8859-1
332     en_GB.UTF-8 UTF-8
333     de_DE ISO-8859-1
334     de_DE@euro ISO-8859-15
335 dertobi123 1.15 </pre>
336    
337     <p>
338 rane 1.43 The next step is to run <c>locale-gen</c>. It will generate all the locales you
339     have specified in the <path>/etc/locale.gen</path> file.
340 dertobi123 1.15 </p>
341    
342 rane 1.43 <note>
343     <c>locale-gen</c> is available in <c>glibc-2.3.6-r4</c> and newer. If you have
344     an older version of glibc, you should update it now.
345     </note>
346 dertobi123 1.15
347 nightmorph 1.44 <p>
348     You can verify that your selected locales are available by running <c>locale
349     -a</c>.
350     </p>
351    
352 dertobi123 1.15 </body>
353     </section>
354 drobbins 1.1 </chapter>
355    
356     <chapter>
357 antifa 1.4 <title>Keyboard layout for the console</title>
358 drobbins 1.1 <section>
359 dertobi123 1.12 <body>
360    
361     <p>
362     The keyboard layout used by the console is set in
363 fox2mike 1.27 <path>/etc/conf.d/keymaps</path> by the <c>KEYMAP</c> variable.
364 dertobi123 1.12 Valid values can be found in
365 cam 1.13 <path>/usr/share/keymaps/<c>{arch}</c>/</path>.
366 dertobi123 1.12 <path>i386</path> has further subdivisions into layout
367     (<path>qwerty/</path>, <path>azerty/</path>, etc.). Some
368     languages have multiple options, so you may wish to experiment
369     to decide which one fits your needs best.
370     </p>
371    
372 neysx 1.39 <pre caption="Setting the console keymap">
373 dertobi123 1.12 KEYMAP="de"
374     KEYMAP="de-latin1"
375     KEYMAP="de-latin1-nodeadkeys"
376 drobbins 1.1 </pre>
377 dertobi123 1.12
378     </body>
379 drobbins 1.1 </section>
380     </chapter>
381    
382     <chapter>
383 antifa 1.4 <title>Keyboard layout for the X server</title>
384 drobbins 1.1 <section>
385 dertobi123 1.12 <body>
386    
387     <p>
388     The keyboard layout to be used by the X server is specified
389 alin 1.21 in <path>/etc/X11/xorg.conf</path> by the <c>XkbLayout</c>
390 dertobi123 1.12 option.
391     </p>
392    
393 neysx 1.39 <pre caption="Setting the X keymap">
394 drobbins 1.1 Section "InputDevice"
395     Identifier "Keyboard1"
396     ...
397     Option "XkbLayout" "de"
398 rane 1.35 #Option "XkbModel" "pc105" <comment>## this is for international keyboards.</comment>
399     # Option "XkbVariant" "nodeadkeys" <comment>## this would be used for xterm input</comment>
400     ...
401     </pre>
402    
403     <p>
404     If you have an international keyboard layout, you should set the option
405     <c>XkbModel</c> to <c>pc102</c> or <c>pc105</c>, as this will allow mapping of the
406     additional keys specific to your keyboard.
407     </p>
408    
409     <p>
410     Deadkeys allow you to press keys that will not show immediately but will be
411     combined with another letter to produce a single character such as é,è,á,à,
412     etc. Setting <c>XkbVariant</c> to <c>nodeadkeys</c> allows input these special
413     characters into X terminals.
414     </p>
415    
416     <p>
417     If you would like to switch between more than one keyboard layout (for example
418     English and Russian), all you have to do is add a few lines to
419     <path>xorg.conf</path> that specify the desired layouts and the shortcut
420     command.
421     </p>
422    
423     <pre caption="Switching between two keyboard layouts">
424     Section "InputDevice"
425     Identifier "Keyboard1"
426 drobbins 1.1 ...
427 rane 1.35 Option "XkbLayout" "us,ru"
428     Option "XkbOptions" "grp:alt_shift_toggle,grp_led:scroll"
429 drobbins 1.1 </pre>
430 dertobi123 1.12
431 rane 1.35 <p>
432     Here, <c>XkbOptions</c> allows you to toggle between keyboard layouts by simply
433     pressing <c>Alt-Shift</c>. This will also toggle the Scroll Lock light on or
434     off, thanks to the <c>grp_led:scroll</c> option. This is a handy visual
435     indicator of which keyboard layout you are using at the moment.
436     </p>
437    
438 dertobi123 1.12 </body>
439 drobbins 1.1 </section>
440     </chapter>
441    
442     <chapter>
443 dertobi123 1.11 <title>KDE</title>
444     <section>
445     <body>
446    
447     <p>
448 flammie 1.32 For KDE you have to install the <c>kde-base/kde-i18n</c> package. Kde-i18n
449     respects <uri link="#variables">LINGUAS variable</uri> described earlier.
450 swift 1.22 </p>
451 dertobi123 1.11
452     </body>
453     </section>
454     </chapter>
455    
456     <chapter>
457 antifa 1.4 <title>The Euro Symbol for the Console</title>
458 drobbins 1.1 <section>
459 dertobi123 1.12 <body>
460    
461     <p>
462     In order to get your console to display the Euro symbol, you
463 cam 1.13 will need to set <c>CONSOLEFONT</c> in
464 rane 1.35 <path>/etc/conf.d/consolefont</path> to a file found in
465 dertobi123 1.12 <path>/usr/share/consolefonts/</path> (without the
466     <c>.psfu.gz</c>). <c>lat9w-16</c> has the Euro symbol.
467     </p>
468    
469 neysx 1.39 <pre caption="Setting the console font">
470 dertobi123 1.12 CONSOLEFONT="lat9w-16"
471 drobbins 1.1 </pre>
472 dertobi123 1.12
473 rane 1.35 <p>
474     You should verify that <c>CONSOLEFONT</c> is in the boot runlevel:
475     </p>
476    
477     <pre caption="Verify the proper runlevel">
478     # <i>rc-update show | grep -i consolefont</i>
479     </pre>
480    
481     <p>
482     If no runlevel is displayed for <c>CONSOLEFONT</c>, then add it to the proper level:
483     </p>
484    
485     <pre caption="Add consolefont to boot">
486     # <i>rc-update add consolefont boot</i>
487     </pre>
488    
489 dertobi123 1.12 </body>
490 drobbins 1.1 </section>
491     </chapter>
492    
493     <chapter>
494 dertobi123 1.12 <title>The Euro Symbol in X</title>
495 drobbins 1.1 <section>
496 dertobi123 1.12 <title>Most Applications</title>
497     <body>
498    
499     <p>
500 nightmorph 1.45 Getting the Euro symbol to work properly in X is a little bit tougher. The
501     first thing you should do is change the <c>fixed</c> and <c>variable</c>
502     definitions in <path>/usr/share/fonts/misc/fonts.alias</path> to end in
503     <c>iso8859-15</c> instead of <c>iso8859-1</c>.
504 dertobi123 1.12 </p>
505    
506 neysx 1.39 <pre caption="Setting default X fonts">
507 dertobi123 1.12 fixed -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-15
508     variable -*-helvetica-bold-r-normal-*-*-120-*-*-*-*-iso8859-15
509 antifa 1.4 </pre>
510 dertobi123 1.12
511     <p>
512 nightmorph 1.45 Some applications use their own font, and you will have to tell them separately
513     to use a font with the Euro symbol. You can do this at a user-specific level in
514     <path>.Xdefaults</path> (you can copy this file to <path>/etc/skel/</path> for
515     use by new users), or at a global level for any application with a resource file
516     in <path>/usr/share/X11/app-defaults/</path> (like xterm). In these files you
517     generally have to change an existing line, rather than adding a new one. To
518     change our xterm font, for instance:
519 dertobi123 1.12 </p>
520    
521 neysx 1.39 <pre caption="Setting fonts for xterm">
522 neysx 1.20 <comment>(in your home directory)</comment>
523 nightmorph 1.38 $ <i>echo 'XTerm*font: fixed' >> .Xresources </i>
524     $ <i>xrdb -merge .Xresources</i>
525 drobbins 1.1 </pre>
526 dertobi123 1.12
527     </body>
528 drobbins 1.1 </section>
529 dertobi123 1.12 <section>
530     <title>The Euro symbol in (X)Emacs</title>
531     <body>
532    
533     <p>
534     To use the Euro symbol in (X)Emacs, add the following to
535     <path>.Xdefaults</path>:
536     </p>
537 drobbins 1.1
538 antifa 1.4 <pre caption="setting the font for emacs">
539 dertobi123 1.12 Emacs.default.attributeFont: -*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-15
540 drobbins 1.1 </pre>
541 dertobi123 1.12
542     <p>
543     For XEmacs (not plain Emacs), you have to do a little
544     more. In <path>/home/user/.xemacs/init.el</path>, add:
545     </p>
546    
547 antifa 1.4 <pre caption="setting the font for xemacs">
548 neysx 1.39 (define-key global-map '(EuroSign) '[€])
549 drobbins 1.1 </pre>
550 dertobi123 1.12
551     <note>
552     The symbol in the []s is the Euro symbol.
553     </note>
554    
555     </body>
556     </section>
557     <section>
558 flammie 1.32 <title>OpenOffice.Org</title>
559 dertobi123 1.12 <body>
560    
561     <p>
562 nightmorph 1.36 The current stable <c>app-office/openoffice</c> and
563     <c>app-office/openoffice-bin</c> ebuilds support the <uri
564     link="#variables">LINGUAS variable</uri> for selecting installed GUI language
565     packs. To see the status of GUI translation, hyphenation, spell checking and
566     other localisations on your language, please refer to <uri
567     link="http://l10n.openoffice.org/languages.html">OpenOffice.Org localisation
568     web site</uri>.
569 dertobi123 1.12 </p>
570    
571     </body>
572 bennyc 1.8 </section>
573 drobbins 1.1 </chapter>
574    
575     </guide>

  ViewVC Help
Powered by ViewVC 1.1.20