website view en/doc/scratchbook/locale.html @ rev 1344

Resize balinor logo to 120px
author Christophe Lincoln <pankso@slitaz.org>
date Fri Jan 22 23:02:15 2021 +0100 (2021-01-22)
parents c2f9d5d0f314
children
line source
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>SliTaz Scratchbook - Locale &amp; i18n</title>
6 <meta name="description" content="">
7 <meta name="expires" content="never">
8 <meta name="modified" content="2008-11-22 17:00:00">
9 <meta name="publisher" content="www.slitaz.org">
10 <meta name="author" content="Christophe Lincoln">
11 <link rel="shortcut icon" href="favicon.ico">
12 <link rel="stylesheet" href="book.css">
13 </head>
14 <body>
16 <!-- Header and quick navigation -->
17 <div id="header">
18 <div align="right" id="quicknav">
19 <span id="top"></span>
20 <a href="base-ncurses.html">Base ncurses</a> |
21 <a href="index.html">Table of contents</a> |
22 <a href="boot-scripts.html">Boot scripts</a>
23 </div>
24 <h1><font color="#3E1220">SliTaz Scratchbook</font></h1>
25 </div>
27 <!-- Content. -->
28 <div id="content">
29 <div class="content-right"></div>
32 <h2><font color="#df8f06">Locale &amp; i18n</font></h2>
33 <p>
34 Installation and configuration of locales.
35 </p>
36 <ul>
37 <li><a href="#install">Locale installation.</a></li>
38 <li><a href="#config">Config and use of locale on SliTaz.</a></li>
39 </ul>
41 <h3 id="install">Locale installation</h3>
42 <p>
43 This chapter describes the installation of locales in SliTaz GNU/Linux from a SliTaz GNU/Linux host system.
44 The installation of locales contained in the X server are described in the chapter
45 <a href="x-window-system.html">X window system</a>. The various files copied in this chapter come from the
46 compiliation package glibc-2.3.6 forming part of the <em>toolchain</em>.
47 </p>
48 <h4>Various file directories</h4>
49 <p>
50 We begin by creating the directories that contain libraries and files relevant to the different locales.
51 The directory LC_MESSAGES contains the files for the translated messages (.mo), if they exist:
52 </p>
53 <pre> # mkdir -p rootfs/usr/share/{i18n,locale}
54 # mkdir -p rootfs/usr/lib/{locale,gconv}
55 # mkdir -p rootfs/usr/share/i18n/{charmaps,locales}
56 # mkdir -p rootfs/usr/share/locale/fr/LC_MESSAGES
57 </pre>
58 <p>
59 Copy the localization files for French, Swiss-French and Swiss-German in /usr/share/i18n/locales:
60 </p>
61 <pre> # cp -a /usr/share/i18n/locales/{de_CH,fr_CH,fr_FR,i18n,iso14651_t1} \
62 rootfs/usr/share/i18n/locales
63 </pre>
64 <p>
65 Copy the translit_* files in /usr/share/i18n/locales:
66 </p>
67 <pre> # cp -a /usr/share/i18n/locales/{translit_circle,translit_cjk_compat} \
68 rootfs/usr/share/i18n/locales
69 # cp -a /usr/share/i18n/locales/{translit_combining,translit_compat} \
70 rootfs/usr/share/i18n/locales
71 # cp -a /usr/share/i18n/locales/{translit_font,translit_fraction} \
72 rootfs/usr/share/i18n/locales
73 # cp -a /usr/share/i18n/locales/{translit_narrow,translit_neutral} \
74 rootfs/usr/share/i18n/locales
75 # cp -a /usr/share/i18n/locales/{translit_small,translit_wide} \
76 rootfs/usr/share/i18n/locales
77 </pre>
78 <p>
79 Copy the charmaps files in /usr/share/i18n/charmaps:
80 </p>
81 <pre> # cp -a /usr/share/i18n/charmaps/ANSI_X3.* rootfs/usr/share/i18n/charmaps
82 # cp -a /usr/share/i18n/charmaps/{ISO-8859-1.gz,ISO-8859-2.gz,ISO-8859-15.gz} \
83 rootfs/usr/share/i18n/charmaps
84 </pre>
85 <p>
86 Copy the gconv libraries in /usr/lib/gconv to rootfs of SliTaz:
87 </p>
88 <pre> # cp /usr/lib/gconv/{ANSI_X3.110.so,gconv-modules,UNICODE.so} \
89 rootfs/usr/lib/gconv
90 # cp /usr/lib/gconv/{ISO8859-1.so,ISO8859-2.so,ISO8859-15.so} \
91 rootfs/usr/lib/gconv
92 # strip -v rootfs/usr/lib/gconv/*.so
93 </pre>
94 <p>
95 Copy the locale utility:
96 </p>
97 <pre> # cp /usr/bin/locale rootfs/usr/bin
98 </pre>
99 <p>
100 It's necessary that the file /usr/lib/locale/locale-archive is generated,
101 for that we use the localedef utility while chrooted in SliTaz:
102 </p>
103 <pre> # cp /usr/bin/localedef rootfs/usr/bin
104 # chroot rootfs /bin/ash
105 </pre>
106 <p>
107 Use of <code>localedef</code> for French-speaking Switzerland and France:
108 </p>
109 <pre> /# localedef -i fr_CH -f ISO-8859-1 fr_CH
110 /# localedef -i fr_FR -f ISO-8859-1 fr_FR
111 /# exit
112 </pre>
113 <p>
114 You can delete the <code>localedef</code> binary to gain some space:
115 </p>
116 <pre> # rm rootfs/usr/bin/localedef
117 </pre>
119 <h3 id="config">Config and use of locale</h3>
120 <p>
121 To use a language in a session, you can create a script launched at boot, or
122 add 2 lines to the ~/.profile specific to each user with:
123 </p>
124 <pre class="script">
125 export LANG=fr_CH
126 export LC_ALL=fr_CH
128 </pre>
129 <p>
130 Voilà, the French language should now function If you installed retawq or nano, you can check the
131 performance of locales by copying the .mo files in the sources of Retawq or Nano to /usr/share/locale/fr/LC_MESSAGES.
132 </p>
133 <h4>Following chapter</h4>
134 <p>
135 SliTaz uses the /etc/init.d/i18n.sh script and the /etc/locale.conf configuration file to
136 manage the system locale. This is detailed in the next chapter <a href="boot-scripts.html">Boot scripts</a>.
137 On a working system, just modify /etc/locale.conf with a text editor or launch ‘tazlocale’
138 to change the default system locale OR to specify the language as a boot option: <code>lang=xx</code>.
139 </p>
142 <!-- End of content -->
143 </div>
145 <!-- Footer. -->
146 <div id="footer">
147 <div class="footer-right"></div>
148 <a href="#top">Top of the page</a> |
149 <a href="index.html">Table of contents</a>
150 </div>
152 <div id="copy">
153 Copyright &copy; <span class="year"></span> <a href="http://www.slitaz.org/en/">SliTaz</a> -
154 <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>;<br />
155 Documentation is under
156 <a href="http://www.gnu.org/copyleft/fdl.html">GNU Free Documentation License</a>
157 and code is <a href="http://validator.w3.org/">valid xHTML 1.0</a>.
158 </div>
160 </body>
161 </html>