/[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 - (show annotations) (download) (as text)
Mon May 7 18:11:40 2007 UTC (6 years, 11 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 <?xml version='1.0' encoding='UTF-8'?>
2 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/guide-localization.xml,v 1.45 2006/11/10 21:24:14 nightmorph Exp $ -->
3 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
4
5 <guide link="/doc/en/guide-localization.xml">
6 <title>Gentoo Linux Localization Guide</title>
7 <author title="Author">
8 Alexander Holler
9 </author>
10 <author title="Translator/Editor">
11 <mail link="slucy@uchicago.edu">Steven Lucy</mail>
12 </author>
13 <author title="Editor">
14 <mail link="bennyc@gentoo.org">Benny Chuang</mail>
15 </author>
16 <author title="Editor">
17 <mail link="pylon@gentoo.org">Lars Weiler</mail>
18 </author>
19 <author title="Editor">
20 <mail link="dertobi123@gentoo.org">Tobias Scherbaum</mail>
21 </author>
22 <author title="Editor">
23 <mail link="flammie@gentoo.org">Flammie Pirinen</mail>
24 </author>
25
26 <abstract>
27 This guide should help users localize their Gentoo Linux distribution to any
28 European locale. It uses Germany as a case-study, since it is translated from
29 the German doc. Includes configuration for use of the euro currency symbol.
30 </abstract>
31
32 <version>1.34</version>
33 <date>2007-05-07</date>
34
35 <chapter>
36 <title>Time zone</title>
37 <section>
38 <body>
39
40 <p>
41 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 <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 </p>
48
49 <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 # <i>date</i>
56 Wed Mar 8 00:46:05 CET 2006
57 </pre>
58
59 <note>
60 Make sure that the timezone indicator (in this case "CET")
61 is correct for your area.
62 </note>
63
64 <note>
65 You can set the value of <c>TZ</c> to be everything after the
66 <path>/usr/share/zoneinfo</path> in your shell rc file
67 (<path>.bash_profile</path> for bash) for a user-level setting. In this case
68 <c>TZ="Europe/Berlin"</c>.
69 </note>
70
71 </body>
72 </section>
73 </chapter>
74
75 <chapter>
76 <title>Hardware Clock</title>
77 <section>
78 <body>
79
80 <p>
81 In most Gentoo Linux installations, your hardware clock is set to
82 UTC (or GMT, Greenwich Mean Time) and then your timezone is
83 taken into account to determine the actual, local time. If,
84 for some reason, you need your hardware clock not to be in UTC,
85 you will need to edit <path>/etc/conf.d/clock</path> and change the
86 value of <c>CLOCK</c> from <c>UTC</c> to <c>local</c>.
87 </p>
88
89 <pre caption="local vs. GMT clock">
90 <comment>(recommended:)</comment>
91 CLOCK="UTC"
92 <comment>(or:)</comment>
93 CLOCK="local"
94 </pre>
95
96 </body>
97 </section>
98 </chapter>
99
100 <chapter>
101 <title>Locale system</title>
102 <section>
103 <title>What are locales?</title>
104 <body>
105
106 <p>
107 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 named <c>ab_CD</c> where <c>ab</c> is your two (or three) letter
112 language code (as specified in ISO-639) and <c>CD</c> is your two letter country
113 code (as specified in ISO-3166).
114 </p>
115
116 </body>
117 </section>
118 <section id="variables">
119 <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 are given in the table below, those with highest precedence (i.e. those
128 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 Define alphabetical ordering of strings. This affects e.g. output of sorted
148 directory listing.
149 </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 <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 <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 </p>
205
206 <pre caption="Setting the user locale in ~/.bashrc">
207 export LANG="de_DE@euro"
208 </pre>
209
210 <note>
211 Append <c>@euro</c> to your locale if you want to use the Euro
212 currency symbol (€)
213 </note>
214
215 <p>
216 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 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 library to extract and use localized messages. Of course, Portage will
236 automatically install it when needed.
237 </p>
238
239 <p>
240 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 <comment>(For system-wide default locale:)</comment>
246 # <i>env-update &amp;&amp; source /etc/profile</i>
247
248 <comment>(For user-specific locale:)</comment>
249 $ <i>source ~/.bashrc</i>
250 </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 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 <pre caption="Setting LINGUAS in make.conf">
275 # <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 </body>
283 </section>
284 <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 <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 </body>
320 </section>
321 <section>
322 <title>Generating locales for glibc</title>
323 <body>
324
325 <p>
326 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 </p>
329
330 <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 </pre>
336
337 <p>
338 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 </p>
341
342 <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
347 <p>
348 You can verify that your selected locales are available by running <c>locale
349 -a</c>.
350 </p>
351
352 </body>
353 </section>
354 </chapter>
355
356 <chapter>
357 <title>Keyboard layout for the console</title>
358 <section>
359 <body>
360
361 <p>
362 The keyboard layout used by the console is set in
363 <path>/etc/conf.d/keymaps</path> by the <c>KEYMAP</c> variable.
364 Valid values can be found in
365 <path>/usr/share/keymaps/<c>{arch}</c>/</path>.
366 <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 <pre caption="Setting the console keymap">
373 KEYMAP="de"
374 KEYMAP="de-latin1"
375 KEYMAP="de-latin1-nodeadkeys"
376 </pre>
377
378 </body>
379 </section>
380 </chapter>
381
382 <chapter>
383 <title>Keyboard layout for the X server</title>
384 <section>
385 <body>
386
387 <p>
388 The keyboard layout to be used by the X server is specified
389 in <path>/etc/X11/xorg.conf</path> by the <c>XkbLayout</c>
390 option.
391 </p>
392
393 <pre caption="Setting the X keymap">
394 Section "InputDevice"
395 Identifier "Keyboard1"
396 ...
397 Option "XkbLayout" "de"
398 #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 ...
427 Option "XkbLayout" "us,ru"
428 Option "XkbOptions" "grp:alt_shift_toggle,grp_led:scroll"
429 </pre>
430
431 <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 </body>
439 </section>
440 </chapter>
441
442 <chapter>
443 <title>KDE</title>
444 <section>
445 <body>
446
447 <p>
448 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 </p>
451
452 </body>
453 </section>
454 </chapter>
455
456 <chapter>
457 <title>The Euro Symbol for the Console</title>
458 <section>
459 <body>
460
461 <p>
462 In order to get your console to display the Euro symbol, you
463 will need to set <c>CONSOLEFONT</c> in
464 <path>/etc/conf.d/consolefont</path> to a file found in
465 <path>/usr/share/consolefonts/</path> (without the
466 <c>.psfu.gz</c>). <c>lat9w-16</c> has the Euro symbol.
467 </p>
468
469 <pre caption="Setting the console font">
470 CONSOLEFONT="lat9w-16"
471 </pre>
472
473 <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 </body>
490 </section>
491 </chapter>
492
493 <chapter>
494 <title>The Euro Symbol in X</title>
495 <section>
496 <title>Most Applications</title>
497 <body>
498
499 <p>
500 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 </p>
505
506 <pre caption="Setting default X fonts">
507 fixed -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-15
508 variable -*-helvetica-bold-r-normal-*-*-120-*-*-*-*-iso8859-15
509 </pre>
510
511 <p>
512 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 </p>
520
521 <pre caption="Setting fonts for xterm">
522 <comment>(in your home directory)</comment>
523 $ <i>echo 'XTerm*font: fixed' >> .Xresources </i>
524 $ <i>xrdb -merge .Xresources</i>
525 </pre>
526
527 </body>
528 </section>
529 <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
538 <pre caption="setting the font for emacs">
539 Emacs.default.attributeFont: -*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-15
540 </pre>
541
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 <pre caption="setting the font for xemacs">
548 (define-key global-map '(EuroSign) '[€])
549 </pre>
550
551 <note>
552 The symbol in the []s is the Euro symbol.
553 </note>
554
555 </body>
556 </section>
557 <section>
558 <title>OpenOffice.Org</title>
559 <body>
560
561 <p>
562 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 </p>
570
571 </body>
572 </section>
573 </chapter>
574
575 </guide>

  ViewVC Help
Powered by ViewVC 1.1.20