slitaz-doc-wiki-data diff pages/en/scratchbook/locale.txt @ rev 91

Added tag 2011.08.14 for changeset a5e4261ee978
author Christopher Rogers <slaxemulator@gmail.com>
date Sun Aug 14 12:45:47 2011 +0000 (2011-08-14)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/pages/en/scratchbook/locale.txt	Sun Aug 14 12:45:47 2011 +0000
     1.3 @@ -0,0 +1,80 @@
     1.4 +====== Locale & i18n ======
     1.5 +
     1.6 +Installation and configuration of locales.
     1.7 +
     1.8 +===== Locale installation =====
     1.9 +
    1.10 +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|X window system]]. The various files copied in this chapter come from the compiliation package glibc-2.3.6 forming part of the //toolchain//.
    1.11 +
    1.12 +==== Various file directories ====
    1.13 +
    1.14 +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:
    1.15 +
    1.16 +   # mkdir -p rootfs/usr/share/{i18n,locale}
    1.17 +   # mkdir -p rootfs/usr/lib/{locale,gconv}
    1.18 +   # mkdir -p rootfs/usr/share/i18n/{charmaps,locales}
    1.19 +   # mkdir -p rootfs/usr/share/locale/fr/LC_MESSAGES
    1.20 +
    1.21 +Copy the localization files for French, Swiss-French and Swiss-German in /usr/share/i18n/locales:
    1.22 +
    1.23 +   # cp -a /usr/share/i18n/locales/{de_CH,fr_CH,fr_FR,i18n,iso14651_t1} \
    1.24 +     rootfs/usr/share/i18n/locales
    1.25 +
    1.26 +Copy the translit_* files in /usr/share/i18n/locales:
    1.27 +
    1.28 +   # cp -a /usr/share/i18n/locales/{translit_circle,translit_cjk_compat} \
    1.29 +     rootfs/usr/share/i18n/locales
    1.30 +   # cp -a /usr/share/i18n/locales/{translit_combining,translit_compat} \
    1.31 +     rootfs/usr/share/i18n/locales
    1.32 +   # cp -a /usr/share/i18n/locales/{translit_font,translit_fraction} \
    1.33 +     rootfs/usr/share/i18n/locales
    1.34 +   # cp -a /usr/share/i18n/locales/{translit_narrow,translit_neutral} \
    1.35 +     rootfs/usr/share/i18n/locales
    1.36 +   # cp -a /usr/share/i18n/locales/{translit_small,translit_wide} \
    1.37 +     rootfs/usr/share/i18n/locales
    1.38 +
    1.39 +Copy the charmaps files in /usr/share/i18n/charmaps:
    1.40 +
    1.41 +   # cp -a /usr/share/i18n/charmaps/ANSI_X3.* rootfs/usr/share/i18n/charmaps
    1.42 +   # cp -a /usr/share/i18n/charmaps/{ISO-8859-1.gz,ISO-8859-2.gz,ISO-8859-15.gz} \
    1.43 +     rootfs/usr/share/i18n/charmaps
    1.44 +
    1.45 +Copy the gconv libraries in /usr/lib/gconv to rootfs of SliTaz:
    1.46 +
    1.47 +   # cp /usr/lib/gconv/{ANSI_X3.110.so,gconv-modules,UNICODE.so} \
    1.48 +     rootfs/usr/lib/gconv
    1.49 +   # cp /usr/lib/gconv/{ISO8859-1.so,ISO8859-2.so,ISO8859-15.so} \
    1.50 +     rootfs/usr/lib/gconv
    1.51 +   # strip -v rootfs/usr/lib/gconv/*.so
    1.52 +
    1.53 +Copy the locale utility:
    1.54 +
    1.55 +   # cp /usr/bin/locale rootfs/usr/bin
    1.56 +
    1.57 +It's necessary that the file /usr/lib/locale/locale-archive is generated, for that we use the localedef utility while chrooted in SliTaz:
    1.58 +
    1.59 +   # cp /usr/bin/localedef rootfs/usr/bin
    1.60 +   # chroot rootfs /bin/ash
    1.61 +
    1.62 +Use of "localedef" for French-speaking Switzerland and France:
    1.63 +
    1.64 +   # localedef -i fr_CH -f ISO-8859-1 fr_CH
    1.65 +   # localedef -i fr_FR -f ISO-8859-1 fr_FR
    1.66 +   # exit
    1.67 +
    1.68 +You can delete the "localedef" binary to gain some space:
    1.69 +
    1.70 +   # rm rootfs/usr/bin/localedef
    1.71 +
    1.72 +===== Config and use of locale =====
    1.73 +
    1.74 +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:
    1.75 +<file>
    1.76 +  export LANG=fr_CH
    1.77 +  export LC_ALL=fr_CH
    1.78 +</file>
    1.79 +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.
    1.80 +
    1.81 +==== Following chapter ====
    1.82 +
    1.83 +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|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".