/[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 - (show annotations) (download) (as text)
Thu Oct 4 20:19:59 2007 UTC (6 years, 9 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 <?xml version='1.0' encoding='UTF-8'?>
2 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/guide-localization.xml,v 1.47 2007/07/08 01:42:20 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.36</version>
33 <date>2007-10-04</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 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 </p>
117
118 </body>
119 </section>
120 <section id="variables">
121 <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 are given in the table below, those with highest precedence (i.e. those
130 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 Define alphabetical ordering of strings. This affects e.g. output of sorted
150 directory listing.
151 </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 <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 <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 </p>
207
208 <pre caption="Setting the user locale in ~/.bashrc">
209 export LANG="de_DE@euro"
210 </pre>
211
212 <note>
213 Append <c>@euro</c> to your locale if you want to use the Euro
214 currency symbol (€)
215 </note>
216
217 <p>
218 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 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 library to extract and use localized messages. Of course, Portage will
238 automatically install it when needed.
239 </p>
240
241 <p>
242 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 <comment>(For system-wide default locale:)</comment>
248 # <i>env-update &amp;&amp; source /etc/profile</i>
249
250 <comment>(For user-specific locale:)</comment>
251 $ <i>source ~/.bashrc</i>
252 </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 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 <pre caption="Setting LINGUAS in make.conf">
277 # <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 </body>
285 </section>
286 <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 <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 </body>
322 </section>
323 <section>
324 <title>Generating locales for glibc</title>
325 <body>
326
327 <p>
328 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 </p>
331
332 <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 </pre>
338
339 <p>
340 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 </p>
343
344 <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
349 <p>
350 You can verify that your selected locales are available by running <c>locale
351 -a</c>.
352 </p>
353
354 </body>
355 </section>
356 </chapter>
357
358 <chapter>
359 <title>Keyboard layout for the console</title>
360 <section>
361 <body>
362
363 <p>
364 The keyboard layout used by the console is set in
365 <path>/etc/conf.d/keymaps</path> by the <c>KEYMAP</c> variable.
366 Valid values can be found in
367 <path>/usr/share/keymaps/<c>{arch}</c>/</path>.
368 <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 <pre caption="Setting the console keymap">
375 KEYMAP="de"
376 KEYMAP="de-latin1"
377 KEYMAP="de-latin1-nodeadkeys"
378 </pre>
379
380 </body>
381 </section>
382 </chapter>
383
384 <chapter>
385 <title>Keyboard layout for the X server</title>
386 <section>
387 <body>
388
389 <p>
390 The keyboard layout to be used by the X server is specified
391 in <path>/etc/X11/xorg.conf</path> by the <c>XkbLayout</c>
392 option.
393 </p>
394
395 <pre caption="Setting the X keymap">
396 Section "InputDevice"
397 Identifier "Keyboard1"
398 ...
399 Option "XkbLayout" "de"
400 #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 ...
429 Option "XkbLayout" "us,ru"
430 Option "XkbOptions" "grp:alt_shift_toggle,grp_led:scroll"
431 </pre>
432
433 <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 </body>
441 </section>
442 </chapter>
443
444 <chapter>
445 <title>KDE</title>
446 <section>
447 <body>
448
449 <p>
450 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 </p>
453
454 </body>
455 </section>
456 </chapter>
457
458 <chapter>
459 <title>The Euro Symbol for the Console</title>
460 <section>
461 <body>
462
463 <p>
464 In order to get your console to display the Euro symbol, you
465 will need to set <c>CONSOLEFONT</c> in
466 <path>/etc/conf.d/consolefont</path> to a file found in
467 <path>/usr/share/consolefonts/</path> (without the
468 <c>.psfu.gz</c>). <c>lat9w-16</c> has the Euro symbol.
469 </p>
470
471 <pre caption="Setting the console font">
472 CONSOLEFONT="lat9w-16"
473 </pre>
474
475 <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 # <i>rc-update -v show | grep -i consolefont</i>
481 </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 </body>
492 </section>
493 </chapter>
494
495 <chapter>
496 <title>The Euro Symbol in X</title>
497 <section>
498 <title>Most Applications</title>
499 <body>
500
501 <p>
502 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 </p>
507
508 <pre caption="Setting default X fonts">
509 fixed -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-15
510 variable -*-helvetica-bold-r-normal-*-*-120-*-*-*-*-iso8859-15
511 </pre>
512
513 <p>
514 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 </p>
522
523 <pre caption="Setting fonts for xterm">
524 <comment>(in your home directory)</comment>
525 $ <i>echo 'XTerm*font: fixed' >> .Xresources </i>
526 $ <i>xrdb -merge .Xresources</i>
527 </pre>
528
529 </body>
530 </section>
531 <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
540 <pre caption="setting the font for emacs">
541 Emacs.default.attributeFont: -*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-15
542 </pre>
543
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 <pre caption="setting the font for xemacs">
550 (define-key global-map '(EuroSign) '[€])
551 </pre>
552
553 <note>
554 The symbol in the []s is the Euro symbol.
555 </note>
556
557 </body>
558 </section>
559 <section>
560 <title>OpenOffice.Org</title>
561 <body>
562
563 <p>
564 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 </p>
572
573 </body>
574 </section>
575 </chapter>
576
577 </guide>

  ViewVC Help
Powered by ViewVC 1.1.20