Installation and configuration of locales.
This chapter describes the installation of locales in SliTaz GNU/Linux from a SliTaz GNU/Linux host system. The installation of locales contained in the X server are described in the chapter X window system. The various files copied in this chapter come from the compiliation package glibc-2.3.6 forming part of the toolchain.
We begin by creating the directories that contain libraries and files relevant to the different locales. The directory LC_MESSAGES contains the files for the translated messages (.mo), if they exist:
# mkdir -p rootfs/usr/share/{i18n,locale} # mkdir -p rootfs/usr/lib/{locale,gconv} # mkdir -p rootfs/usr/share/i18n/{charmaps,locales} # mkdir -p rootfs/usr/share/locale/fr/LC_MESSAGES
Copy the localization files for French, Swiss-French and Swiss-German in /usr/share/i18n/locales:
# cp -a /usr/share/i18n/locales/{de_CH,fr_CH,fr_FR,i18n,iso14651_t1} \ rootfs/usr/share/i18n/locales
Copy the translit_* files in /usr/share/i18n/locales:
# cp -a /usr/share/i18n/locales/{translit_circle,translit_cjk_compat} \ rootfs/usr/share/i18n/locales # cp -a /usr/share/i18n/locales/{translit_combining,translit_compat} \ rootfs/usr/share/i18n/locales # cp -a /usr/share/i18n/locales/{translit_font,translit_fraction} \ rootfs/usr/share/i18n/locales # cp -a /usr/share/i18n/locales/{translit_narrow,translit_neutral} \ rootfs/usr/share/i18n/locales # cp -a /usr/share/i18n/locales/{translit_small,translit_wide} \ rootfs/usr/share/i18n/locales
Copy the charmaps files in /usr/share/i18n/charmaps:
# cp -a /usr/share/i18n/charmaps/ANSI_X3.* rootfs/usr/share/i18n/charmaps # cp -a /usr/share/i18n/charmaps/{ISO-8859-1.gz,ISO-8859-2.gz,ISO-8859-15.gz} \ rootfs/usr/share/i18n/charmaps
Copy the gconv libraries in /usr/lib/gconv to rootfs of SliTaz:
# cp /usr/lib/gconv/{ANSI_X3.110.so,gconv-modules,UNICODE.so} \ rootfs/usr/lib/gconv # cp /usr/lib/gconv/{ISO8859-1.so,ISO8859-2.so,ISO8859-15.so} \ rootfs/usr/lib/gconv # strip -v rootfs/usr/lib/gconv/*.so
Copy the locale utility:
# cp /usr/bin/locale rootfs/usr/bin
It's necessary that the file /usr/lib/locale/locale-archive is generated, for that we use the localedef utility while chrooted in SliTaz:
# cp /usr/bin/localedef rootfs/usr/bin # chroot rootfs /bin/ash
Use of “localedef” for French-speaking Switzerland and France:
# localedef -i fr_CH -f ISO-8859-1 fr_CH # localedef -i fr_FR -f ISO-8859-1 fr_FR # exit
You can delete the “localedef” binary to gain some space:
# rm rootfs/usr/bin/localedef
To use a language in a session, you can create a script launched at boot, or add 2 lines to the ~/.profile specific to each user with:
export LANG=fr_CH export LC_ALL=fr_CH
Voilà, the French language should now function If you installed retawq or nano, you can check the performance of locales by copying the .mo files in the sources of Retawq or Nano to /usr/share/locale/fr/LC_MESSAGES.
SliTaz uses the /etc/init.d/i18n.sh script and the /etc/locale.conf configuration file to manage the system locale. This is detailed in the next chapter Boot scripts. On a working system, just modify /etc/locale.conf with a text editor or launch 'tazlocale' to change the default system locale Or to specify the language as a boot option: “lang=xx”.