/[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.48 - (hide annotations) (download) (as text)
Thu Oct 4 20:19:59 2007 UTC (6 years, 11 months ago) by neysx
Branch: MAIN
Changes since 1.47: +12 -10 lines
File MIME type: application/xml
Mention variants as suggest on the -doc ML

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

  ViewVC Help
Powered by ViewVC 1.1.20