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