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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.33 Revision 1.50
1<?xml version='1.0' encoding='UTF-8'?> 1<?xml version='1.0' encoding='UTF-8'?>
2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/guide-localization.xml,v 1.33 2005/11/25 20:36:01 jkt Exp $ --> 2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/guide-localization.xml,v 1.50 2008/11/30 11:28:59 jkt Exp $ -->
3<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 3<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
4 4
5<guide link="/doc/en/guide-localization.xml"> 5<guide link="/doc/en/guide-localization.xml">
6<title>Gentoo Linux Localization Guide</title> 6<title>Gentoo Linux Localization Guide</title>
7<author title="Author"> 7<author title="Author">
27This guide should help users localize their Gentoo Linux distribution to any 27This guide should help users localize their Gentoo Linux distribution to any
28European locale. It uses Germany as a case-study, since it is translated from 28European locale. It uses Germany as a case-study, since it is translated from
29the German doc. Includes configuration for use of the euro currency symbol. 29the German doc. Includes configuration for use of the euro currency symbol.
30</abstract> 30</abstract>
31 31
32<version>1.24</version> 32<version>1.38</version>
33<date>2005-11-25</date> 33<date>2008-11-30</date>
34 34
35<chapter> 35<chapter>
36<title>Time zone</title> 36<title>Time zone</title>
37<section> 37<section>
38<body> 38<body>
39 39
40<p> 40<p>
41In order to keep time properly, <path>/etc/localtime</path> must contain the 41In order to keep time properly, you need to select your timezone so that your
42correct time zone data file. Look around in <path>/usr/share/zoneinfo/</path> 42system knows where it is located. Look for your timezone in
43and pick your timezone or a near-by big city. Please avoid the 43<path>/usr/share/zoneinfo</path>. You then set your timezone in
44<path>/etc/conf.d/clock</path>. Please avoid the
44<path>/usr/share/zoneinfo/Etc/GMT*</path> timezones as their names do not 45<path>/usr/share/zoneinfo/Etc/GMT*</path> timezones as their names do not
45indicate the expected zones. For instance, <path>GMT-8</path> is in fact GMT+8. 46indicate the expected zones. For instance, <path>GMT-8</path> is in fact GMT+8.
46</p> 47</p>
47 48
48<pre caption="setting the timezone"> 49<pre caption="Setting the timezone information">
49# <i>cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime</i> 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>
53TIMEZONE="Europe/Brussels"
54
50# <i>date</i> 55# <i>date</i>
51Sun Feb 16 08:26:44 CET 2003 56Wed Mar 8 00:46:05 CET 2006
52</pre> 57</pre>
53 58
54<note> 59<note>
55Make sure that the three-letter timezone indicator (in this case "CET") 60Make sure that the timezone indicator (in this case "CET")
56is correct for your area. 61is correct for your area.
57</note> 62</note>
58 63
59<note> 64<note>
60You can set the value of <c>TZ</c> to be everything after the 65You can set the value of <c>TZ</c> to be everything after the
97<section> 102<section>
98<title>What are locales?</title> 103<title>What are locales?</title>
99<body> 104<body>
100 105
101<p> 106<p>
102A Locale is a set of information that most programs use for determining 107A Locale is a set of information that most programs use for determining country
103country and language specific settings. The locales and their data 108and language specific settings. The locales and their data are part of the
104are part of the system library and can be found 109system library and can be found at <path>/usr/share/locale</path> on most
105at <path>/usr/share/locale</path> on most systems. A locale name is generally 110systems. A locale name is generally named <c>ab_CD</c> where <c>ab</c> is your
106named <c>ab_CD</c> where <c>ab</c> is your two (or three) letter 111two (or three) letter language code (as specified in ISO-639) and <c>CD</c> is
107language code (as specified in ISO-639) and <c>CD</c> is your two letter country 112your two letter country code (as specified in ISO-3166). Variants are often
108code (as specified in ISO-3199). 113appended to locale names, e.g. <c>en_GB.utf8</c> or <c>de_DE@euro</c>. Please
114explore <uri link="http://en.wikipedia.org/wiki/Locale">Wikipedia</uri> to read
115more about locales and related articles.
109</p> 116</p>
110 117
111</body> 118</body>
112</section> 119</section>
113<section id="variables"> 120<section id="variables">
117<p> 124<p>
118Locale settings are stored in environment variables. These are typically 125Locale settings are stored in environment variables. These are typically
119set in the <path>/etc/env.d/02locale</path> (for system-wide 126set in the <path>/etc/env.d/02locale</path> (for system-wide
120settings) and <path>~/.bashrc</path> (for user-specific settings) file. 127settings) and <path>~/.bashrc</path> (for user-specific settings) file.
121The variables controlling different aspects of locale settings 128The variables controlling different aspects of locale settings
122are given in the table below, those with highest precedence (ie. those 129are given in the table below. All of them
123that override settings below them) are at the top of the table. All variables
124take one name of a locale in <c>ab_CD</c> format given above. 130take one name of a locale in <c>ab_CD</c> format given above.
125</p> 131</p>
126 132
127<table> 133<table>
128<tr> 134<tr>
129 <th>Variable name</th> 135 <th>Variable name</th>
130 <th>Explanation</th> 136 <th>Explanation</th>
131</tr> 137</tr>
132<tr> 138<tr>
133 <ti>LC_ALL</ti> 139 <ti>LANG</ti>
134 <ti> 140 <ti>
135 Define all locale settings at once. This is the top level setting for 141 Defines all locale settings at once, while allowing further individual
136 locales which will override any other setting. 142 customization via the LC_* settings below.
137 </ti> 143 </ti>
138</tr> 144</tr>
139<tr> 145<tr>
140 <ti>LC_COLLATE</ti> 146 <ti>LC_COLLATE</ti>
141 <ti> 147 <ti>
142 Define alphabetical ordering of strings. This affects eg. output of sorted 148 Define alphabetical ordering of strings. This affects e.g. output of sorted
143 directory listing. 149 directory listing.
144 </ti> 150 </ti>
145</tr> 151</tr>
146<tr> 152<tr>
147 <ti>LC_CTYPE</ti> 153 <ti>LC_CTYPE</ti>
177<tr> 183<tr>
178 <ti>LC_PAPER</ti> 184 <ti>LC_PAPER</ti>
179 <ti>Defines default paper size.</ti> 185 <ti>Defines default paper size.</ti>
180</tr> 186</tr>
181<tr> 187<tr>
182 <ti>LANG</ti> 188 <ti>LC_ALL</ti>
183 <ti> 189 <ti>
184 Defines all locale settings at once. This setting can be overridden by 190 A special variable for overriding all other settings.
185 individual LC_* settings above or even by LC_ALL.
186 </ti> 191 </ti>
187</tr> 192</tr>
188</table> 193</table>
189 194
190<note> 195<note>
191Even though most programs work with LC_ALL only, some of them misbehave if 196Some programs are written in such a way that they expect traditional English
192LC_ALL is set but LANG isn't. If you want to play safe, set them <e>both</e>. 197ordering of the alphabet, while some locales, most notably the Estonian one, use
198a different ordering. Therefore it's recommended to explicitly set LC_COLLATE to C
199when dealing with system-wide settings.
193</note> 200</note>
194 201
195<p> 202<warn>
196Most typically users only set the LANG variable and perhaps LC_CTYPE variable 203For the same reason, using LC_ALL is strongly discouraged. Please use it only
197on user level by adding definitions to shells startup files defining 204when testing and never set it in a startup file.
198the environment variable manually from command line: 205</warn>
206
199</p> 207<p>
208Most typically users only set the LANG variable on the global basis:
209</p>
200 210
201<pre caption="setting the German locale"> 211<pre caption="Setting the default system locale in /etc/env.d/02locale">
202export LANG="de_DE@euro" 212LANG="de_DE.utf8@euro"
213LC_COLLATE="C"
203</pre> 214</pre>
204 215
205<note> 216<note>
206Append <c>@euro</c> to your locale if you want to use the Euro 217Append <c>@euro</c> to your locale if you want to use the Euro
207currency symbol (&#8364;) 218currency symbol ()
208</note> 219</note>
220
221<p>
222It's also possible, and pretty common especially in a more traditional UNIX
223environment, to leave the global settings unchanged, i.e. in the "<c>C</c>"
224locale. Users can still specify their preferred locale in their own shell RC
225file:
226</p>
227
228<pre caption="Setting the user locale in ~/.bashrc">
229export LANG="de_DE.utf8@euro"
230export LC_COLLATE="C"
231</pre>
232
233<p>
234Another way of configuring system is to leave it in the default C locale, but
235enable UTF-8 character representation at the same time. This option is achieved
236using the following settings in <path>/etc/env.d/02locale</path>:
237</p>
238
239<pre caption="Using traditional C locale while specifying UTF-8">
240LC_CTYPE=de_DE.utf8
241</pre>
242
243<p>
244Using the above snippet, users will be able to see localized file names
245properly, while not being forced to your preferred language.
246</p>
209 247
210<p> 248<p>
211For message based localization to work in programs that support it, you will 249For message based localization to work in programs that support it, you will
212probably need to have programs compiled with the <c>nls</c> (Native language 250probably need to have programs compiled with the <c>nls</c> (Native language
213support) USE flag set. Most of the programs using nls also need the gettext 251support) USE flag set. Most of the programs using nls also need the gettext
214library to extract and use localized messages. Of course, Gentoo's Portage will 252library to extract and use localized messages. Of course, Portage will
215automatically install it when needed. 253automatically install it when needed.
216</p> 254</p>
255
256<p>
257Once you have set the right locale, be sure to update your environment
258variables to make your system aware of the change:
259</p>
260
261<pre caption="Update the environment">
262<comment>(For system-wide default locale:)</comment>
263# <i>env-update &amp;&amp; source /etc/profile</i>
264
265<comment>(For user-specific locale:)</comment>
266$ <i>source ~/.bashrc</i>
267</pre>
268
269<p>
270After this, you will need to kill your X server by pressing
271<c>Ctrl-Alt-Backspace</c>, log out, then log in as user.
272</p>
273
274<p>
275Now, verify that the changes have taken effect:
276</p>
277
278<pre caption="Verify env changes">
279$ <i>locale</i>
280</pre>
217 281
218<p> 282<p>
219There is also additional localisation variable called LINGUAS, which affects 283There is also additional localisation variable called LINGUAS, which affects
220to localisation files that get installed in gettext-based programs, and decides 284to localisation files that get installed in gettext-based programs, and decides
221used localisation for some specific software packages, such as 285used localisation for some specific software packages, such as
222<c>kde-base/kde-i18n</c> and <c>app-office/openoffice</c>. The variable 286<c>kde-base/kde-i18n</c> and <c>app-office/openoffice</c>. The variable
223takes in <e>space</e>-separated list of language codes, and suggested 287takes in <e>space</e>-separated list of language codes, and suggested
224place to set it is <path>/etc/make.conf</path>: 288place to set it is <path>/etc/make.conf</path>:
225</p> 289</p>
226 290
227<pre caption="setting LINGUAS in make.conf"> 291<pre caption="Setting LINGUAS in make.conf">
228# <i>nano -w /etc/make.conf</i> 292# <i>nano -w /etc/make.conf</i>
229<comment>(Add in the LINGUAS variable. For instance, 293<comment>(Add in the LINGUAS variable. For instance,
230for German, Finnish and English:)</comment> 294for German, Finnish and English:)</comment>
231LINGUAS="de fi en" 295LINGUAS="de fi en"
232</pre> 296</pre>
254 318
255<pre caption="Exporting the LANG variable"> 319<pre caption="Exporting the LANG variable">
256# <i>export LANG="en_US.ISO-8859-15"</i> 320# <i>export LANG="en_US.ISO-8859-15"</i>
257</pre> 321</pre>
258 322
323<p>
324Be sure to update the environment after the change:
325</p>
326
327<pre caption="Update the environment">
328# <i>env-update &amp;&amp; source /etc/profile</i>
329</pre>
330
331<p>
332After this, you will need to kill your X server by pressing
333<c>Ctrl-Alt-Backspace</c>, log out, then log in as user.
334</p>
335
259</body> 336</body>
260</section>
261<section> 337</section>
262<title>The userlocales USE flag</title> 338<section>
339<title>Generating locales for glibc</title>
263<body> 340<body>
264 341
265<p> 342<p>
266You will probably only use one or maybe two locales on your system. Up until now 343You will probably only use one or maybe two locales on your system. You can
267after compiling <c>glibc</c> a full set of all available locales has been
268created. As of now you can activate the <c>userlocales</c> USE flag and specify
269only the locales you will need in <path>/etc/locales.build</path>. 344specify locales you will need in <path>/etc/locale.gen</path>.
270</p>
271
272<pre caption="Activate the userlocales USE flag especially for glibc">
273echo "sys-libs/glibc userlocales" >> /etc/portage/package.use
274</pre>
275
276<p> 345</p>
277Now specify the locales you want to be able to use:
278</p>
279 346
280<pre caption="Adding locales to /etc/locales.build"> 347<pre caption="Adding locales to /etc/locale.gen">
281en_US/ISO-8859-1 348en_GB ISO-8859-1
282en_US.UTF-8/UTF-8 349en_GB.UTF-8 UTF-8
283de_DE/ISO-8859-1 350de_DE ISO-8859-1
284de_DE@euro/ISO-8859-15 351de_DE@euro ISO-8859-15
285</pre> 352</pre>
286 353
354<p>
355The next step is to run <c>locale-gen</c>. It will generate all the locales you
356have specified in the <path>/etc/locale.gen</path> file.
287<p> 357</p>
288The next step is to re-compile <c>glibc</c>. Of course you can defer this until 358
289the next <c>glibc</c> upgrade is available. 359<note>
360<c>locale-gen</c> is available in <c>glibc-2.3.6-r4</c> and newer. If you have
361an older version of glibc, you should update it now.
362</note>
363
364<p>
365You can verify that your selected locales are available by running <c>locale
366-a</c>.
290</p> 367</p>
291 368
292</body> 369</body>
293</section> 370</section>
294</chapter> 371</chapter>
307(<path>qwerty/</path>, <path>azerty/</path>, etc.). Some 384(<path>qwerty/</path>, <path>azerty/</path>, etc.). Some
308languages have multiple options, so you may wish to experiment 385languages have multiple options, so you may wish to experiment
309to decide which one fits your needs best. 386to decide which one fits your needs best.
310</p> 387</p>
311 388
312<pre caption="setting the console keymap"> 389<pre caption="Setting the console keymap">
313KEYMAP="de" 390KEYMAP="de"
314KEYMAP="de-latin1" 391KEYMAP="de-latin1"
315KEYMAP="de-latin1-nodeadkeys" 392KEYMAP="de-latin1-nodeadkeys"
316</pre> 393</pre>
317 394
328The keyboard layout to be used by the X server is specified 405The keyboard layout to be used by the X server is specified
329in <path>/etc/X11/xorg.conf</path> by the <c>XkbLayout</c> 406in <path>/etc/X11/xorg.conf</path> by the <c>XkbLayout</c>
330option. 407option.
331</p> 408</p>
332 409
333<pre caption="setting the X keymap"> 410<pre caption="Setting the X keymap">
334 Section "InputDevice" 411 Section "InputDevice"
335 Identifier "Keyboard1" 412 Identifier "Keyboard1"
336 ... 413 ...
337 Option "XkbLayout" "de" 414 Option "XkbLayout" "de"
338 # Option "XkbVariant" "nodeadkeys" 415 #Option "XkbModel" "pc105" <comment>## this is for international keyboards.</comment>
416 # Option "XkbVariant" "nodeadkeys" <comment>## this would be used for xterm input</comment>
339 ... 417 ...
340</pre> 418</pre>
419
420<p>
421If you have an international keyboard layout, you should set the option
422<c>XkbModel</c> to <c>pc102</c> or <c>pc105</c>, as this will allow mapping of the
423additional keys specific to your keyboard.
424</p>
425
426<p>
427Deadkeys allow you to press keys that will not show immediately but will be
428combined with another letter to produce a single character such as é,è,á,à,
429etc. Setting <c>XkbVariant</c> to <c>nodeadkeys</c> allows input these special
430characters into X terminals.
431</p>
432
433<p>
434If you would like to switch between more than one keyboard layout (for example
435English and Russian), all you have to do is add a few lines to
436<path>xorg.conf</path> that specify the desired layouts and the shortcut
437command.
438</p>
439
440<pre caption="Switching between two keyboard layouts">
441 Section "InputDevice"
442 Identifier "Keyboard1"
443 ...
444 Option "XkbLayout" "us,ru"
445 Option "XkbOptions" "grp:alt_shift_toggle,grp_led:scroll"
446</pre>
447
448<p>
449Here, <c>XkbOptions</c> allows you to toggle between keyboard layouts by simply
450pressing <c>Alt-Shift</c>. This will also toggle the Scroll Lock light on or
451off, thanks to the <c>grp_led:scroll</c> option. This is a handy visual
452indicator of which keyboard layout you are using at the moment.
453</p>
341 454
342</body> 455</body>
343</section> 456</section>
344</chapter> 457</chapter>
345 458
363<body> 476<body>
364 477
365<p> 478<p>
366In order to get your console to display the Euro symbol, you 479In order to get your console to display the Euro symbol, you
367will need to set <c>CONSOLEFONT</c> in 480will need to set <c>CONSOLEFONT</c> in
368<path>/etc/rc.conf</path> to a file found in 481<path>/etc/conf.d/consolefont</path> to a file found in
369<path>/usr/share/consolefonts/</path> (without the 482<path>/usr/share/consolefonts/</path> (without the
370<c>.psfu.gz</c>). <c>lat9w-16</c> has the Euro symbol. 483<c>.psfu.gz</c>). <c>lat9w-16</c> has the Euro symbol.
371</p> 484</p>
372 485
373<pre caption="setting the console font"> 486<pre caption="Setting the console font">
374CONSOLEFONT="lat9w-16" 487CONSOLEFONT="lat9w-16"
375</pre> 488</pre>
376 489
490<p>
491You should verify that <c>CONSOLEFONT</c> is in the boot runlevel:
492</p>
493
494<pre caption="Verify the proper runlevel">
495# <i>rc-update -v show | grep -i consolefont</i>
496</pre>
497
498<p>
499If no runlevel is displayed for <c>CONSOLEFONT</c>, then add it to the proper level:
500</p>
501
502<pre caption="Add consolefont to boot">
503# <i>rc-update add consolefont boot</i>
504</pre>
505
377</body> 506</body>
378</section> 507</section>
379</chapter> 508</chapter>
380 509
381<chapter> 510<chapter>
383<section> 512<section>
384<title>Most Applications</title> 513<title>Most Applications</title>
385<body> 514<body>
386 515
387<p> 516<p>
388Getting the Euro symbol to work properly in X is a little 517Getting the Euro symbol to work properly in X is a little bit tougher. The
389bit tougher. The first thing you should do is change the <c>fixed</c> 518first thing you should do is change the <c>fixed</c> and <c>variable</c>
390and <c>variable</c> definitions in 519definitions in <path>/usr/share/fonts/misc/fonts.alias</path> to end in
391<path>/usr/X11R6/lib/X11/fonts/misc/fonts.alias</path> to end
392in <c>iso8859-15</c> instead of <c>iso8859-1</c>. 520<c>iso8859-15</c> instead of <c>iso8859-1</c>.
393</p> 521</p>
394 522
395<pre caption="setting default X fonts"> 523<pre caption="Setting default X fonts">
396fixed -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-15 524fixed -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-15
397variable -*-helvetica-bold-r-normal-*-*-120-*-*-*-*-iso8859-15 525variable -*-helvetica-bold-r-normal-*-*-120-*-*-*-*-iso8859-15
398</pre> 526</pre>
399 527
400<p> 528<p>
401Some applications use their own font, and you will have to 529Some applications use their own font, and you will have to tell them separately
402tell them separately to use a font with the Euro symbol. You 530to use a font with the Euro symbol. You can do this at a user-specific level in
403can do this at a user-specific level in
404<path>.Xdefaults</path> (you can copy this file to 531<path>.Xdefaults</path> (you can copy this file to <path>/etc/skel/</path> for
405<path>/etc/skel/</path> for use by new users), or at a global 532use by new users), or at a global level for any application with a resource file
406level for any application with a resource file in
407<path>/usr/X11R6/lib/X11/app-defaults/</path> (like xterm). In 533in <path>/usr/share/X11/app-defaults/</path> (like xterm). In these files you
408these files you generally have to change an existing line, 534generally have to change an existing line, rather than adding a new one. To
409rather than adding a new one. To change our xterm font, for 535change our xterm font, for instance:
410instance:
411</p> 536</p>
412 537
413<pre caption="setting fonts for xterm"> 538<pre caption="Setting fonts for xterm">
414<comment>(in your home directory)</comment> 539<comment>(in your home directory)</comment>
415# <i>echo 'XTerm*font: fixed' >> .Xresources </i> 540$ <i>echo 'XTerm*font: fixed' >> .Xresources </i>
416# <i>xrdb -merge .Xresources</i> 541$ <i>xrdb -merge .Xresources</i>
417</pre> 542</pre>
418 543
419</body> 544</body>
420</section> 545</section>
421<section> 546<section>
435For XEmacs (not plain Emacs), you have to do a little 560For XEmacs (not plain Emacs), you have to do a little
436more. In <path>/home/user/.xemacs/init.el</path>, add: 561more. In <path>/home/user/.xemacs/init.el</path>, add:
437</p> 562</p>
438 563
439<pre caption="setting the font for xemacs"> 564<pre caption="setting the font for xemacs">
440(define-key global-map '(EuroSign) '[&#8364;]) 565(define-key global-map '(EuroSign) '[])
441</pre> 566</pre>
442 567
443<note> 568<note>
444The symbol in the []s is the Euro symbol. 569The symbol in the []s is the Euro symbol.
445</note> 570</note>
449<section> 574<section>
450<title>OpenOffice.Org</title> 575<title>OpenOffice.Org</title>
451<body> 576<body>
452 577
453<p> 578<p>
454The current <c>app-office/openoffice</c> (or <c>-ximian</c>) source ebuilds 579The current stable <c>app-office/openoffice</c> and
580<c>app-office/openoffice-bin</c> ebuilds support the <uri
455support <uri link="#variables">LINGUAS variable</uri> for selecting installed 581link="#variables">LINGUAS variable</uri> for selecting installed GUI language
456GUI language packs. The current <e>stable</e> 582packs. To see the status of GUI translation, hyphenation, spell checking and
457<c>app-office/openoffice-bin</c> binary ebuilds do <e>not</e> yet 583other localisations on your language, please refer to <uri
458support LINGUAS variable, however, so in order to use localised OpenOffice.Org
459you must either install the source version, or, with your discretion, the
460unstable binary version. To see status of GUI translation,
461hyphenation, spell checking and other localisations on your language, please
462refer to
463<uri link="http://l10n.openoffice.org/languages.html">OpenOffice.Org 584link="http://l10n.openoffice.org/languages.html">OpenOffice.Org localisation
464localisation web site</uri>. 585web site</uri>.
465</p> 586</p>
466 587
467</body> 588</body>
468</section> 589</section>
469</chapter> 590</chapter>

Legend:
Removed from v.1.33  
changed lines
  Added in v.1.50

  ViewVC Help
Powered by ViewVC 1.1.20