old-www/LDP/www.debian.org/doc/manuals/debian-reference/ch08.en.html

505 lines
37 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Chapter 8. I18N and L10N</title>
<link rel="stylesheet" href="debian-reference.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.en.html" title="Debian Reference">
<link rel="up" href="index.en.html" title="Debian Reference">
<link rel="prev" href="ch07.en.html" title="Chapter 7. The X Window System">
<link rel="next" href="ch09.en.html" title="Chapter 9. System tips">
<link rel="preface" href="pr01.en.html" title="Preface">
<link rel="chapter" href="ch01.en.html" title="Chapter 1. GNU/Linux tutorials">
<link rel="chapter" href="ch02.en.html" title="Chapter 2. Debian package management">
<link rel="chapter" href="ch03.en.html" title="Chapter 3. The system initialization">
<link rel="chapter" href="ch04.en.html" title="Chapter 4. Authentication">
<link rel="chapter" href="ch05.en.html" title="Chapter 5. Network setup">
<link rel="chapter" href="ch06.en.html" title="Chapter 6. Network applications">
<link rel="chapter" href="ch07.en.html" title="Chapter 7. The X Window System">
<link rel="chapter" href="ch08.en.html" title="Chapter 8. I18N and L10N">
<link rel="chapter" href="ch09.en.html" title="Chapter 9. System tips">
<link rel="chapter" href="ch10.en.html" title="Chapter 10. Data management">
<link rel="chapter" href="ch11.en.html" title="Chapter 11. Data conversion">
<link rel="chapter" href="ch12.en.html" title="Chapter 12. Programming">
<link rel="appendix" href="apa.en.html" title="Appendix A. Appendix">
<link rel="section" href="ch08.en.html#_the_keyboard_input" title="8.1. The keyboard input">
<link rel="section" href="ch08.en.html#_the_display_output" title="8.2. The display output">
<link rel="section" href="ch08.en.html#_the_locale" title="8.3. The locale">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">Chapter 8. I18N and L10N</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="ch07.en.html"><img src="images/prev.gif" alt="Prev"></a> </td>
<th width="60%" align="center"> </th>
<td width="20%" align="right"> <a accesskey="n" href="ch09.en.html"><img src="images/next.gif" alt="Next"></a>
</td>
</tr>
</table>
<hr>
</div>
<div class="chapter">
<div class="titlepage"><div><div><h2 class="title">
<a name="_i18n_and_l10n"></a>Chapter 8. I18N and L10N</h2></div></div></div>
<div class="toc">
<p><b>Table of Contents</b></p>
<dl>
<dt><span class="section"><a href="ch08.en.html#_the_keyboard_input">8.1. The keyboard input</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="ch08.en.html#_the_input_method_support_with_ibus">8.1.1. The input method support with IBus</a></span></dt>
<dt><span class="section"><a href="ch08.en.html#_an_example_for_japanese">8.1.2. An example for Japanese</a></span></dt>
<dt><span class="section"><a href="ch08.en.html#_disabling_the_input_method">8.1.3. Disabling the input method</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="ch08.en.html#_the_display_output">8.2. The display output</a></span></dt>
<dt><span class="section"><a href="ch08.en.html#_the_locale">8.3. The locale</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="ch08.en.html#_basics_of_encoding">8.3.1. Basics of encoding</a></span></dt>
<dt><span class="section"><a href="ch08.en.html#_rationale_for_utf_8_locale">8.3.2. Rationale for UTF-8 locale</a></span></dt>
<dt><span class="section"><a href="ch08.en.html#_the_reconfiguration_of_the_locale">8.3.3. The reconfiguration of the locale</a></span></dt>
<dt><span class="section"><a href="ch08.en.html#_the_value_of_the_literal_lang_literal_environment_variable">8.3.4. The value of the "<code class="literal">$LANG</code>" environment variable</a></span></dt>
<dt><span class="section"><a href="ch08.en.html#_specific_locale_only_under_x_window">8.3.5. Specific locale only under X Window</a></span></dt>
<dt><span class="section"><a href="ch08.en.html#_filename_encoding">8.3.6. Filename encoding</a></span></dt>
<dt><span class="section"><a href="ch08.en.html#_localized_messages_and_translated_documentation">8.3.7. Localized messages and translated documentation</a></span></dt>
<dt><span class="section"><a href="ch08.en.html#_effects_of_the_locale">8.3.8. Effects of the locale</a></span></dt>
</dl></dd>
</dl>
</div>
<p><a class="ulink" href="http://en.wikipedia.org/wiki/Internationalization_and_localization" target="_top">Multilingualization (M17N) or Native Language Support</a> for an application software is done in 2 steps.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
Internationalization (I18N): To make a software potentially handle multiple locales.
</p></li>
<li class="listitem"><p>
Localization (L10N): To make a software handle an specific locale.
</p></li>
</ul></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>There are 17, 18, or 10 letters between "m" and "n", "i" and "n", or "l" and "n" in multilingualization, internationalization, and localization which correspond to M17N, I18N, and L10N.</p></td></tr>
</table></div>
<p>The modern software such as GNOME and KDE are multilingualized. They are internationalized by making them handle <a class="ulink" href="http://en.wikipedia.org/wiki/UTF-8" target="_top">UTF-8</a> data and localized by providing their translated messages through the <span class="citerefentry"><span class="refentrytitle">gettext</span>(1)</span> infrastructure. Translated messages may be provided as separate localization packages. They can be selected simply by setting pertinent environment variables to the appropriate locale.</p>
<p>The simplest representation of the text data is <span class="strong"><strong>ASCII</strong></span> which is sufficient for English and uses less than 127 characters (representable with 7 bits). In order to support much more characters for the international support, many character encoding systems have been invented. The modern and sensible encoding system is <span class="strong"><strong>UTF-8</strong></span> which can handle practically all the characters known to the human (see <a class="xref" href="ch08.en.html#_basics_of_encoding" title="8.3.1. Basics of encoding">Section 8.3.1, “Basics of encoding”</a>).</p>
<p>See <a class="ulink" href="http://www.debian.org/doc/manuals/intro-i18n/" target="_top">Introduction to i18n</a> for details.</p>
<p>The international hardware support is enabled with localized hardware configuration data.</p>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="_the_keyboard_input"></a>8.1. The keyboard input</h2></div></div></div>
<p>The Debian system can be configured to work with many international keyboard arrangements.</p>
<div class="table">
<a name="listofkeyboardreigurationmethods"></a><p class="title"><b>Table 8.1. List of keyboard reconfiguration methods</b></p>
<div class="table-contents"><table summary="List of keyboard reconfiguration methods" border="1">
<colgroup>
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
environment
</th>
<th align="left">
command
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
Linux console
</td>
<td align="left">
<code class="literal">dpkg-reconfigure --priority=low console-data</code>
</td>
</tr>
<tr>
<td align="left">
X Window
</td>
<td align="left">
<code class="literal">dpkg-reconfigure --priority=low xserver-xorg</code>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>This supports keyboard input for accented characters of many European languages with its dead-key function. For Asian languages, you need more complicated <a class="ulink" href="http://en.wikipedia.org/wiki/Input_method" target="_top">input method</a> support such as <a class="ulink" href="http://en.wikipedia.org/wiki/Intelligent_Input_Bus" target="_top">IBus</a> discussed next.</p>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_the_input_method_support_with_ibus"></a>8.1.1. The input method support with IBus</h3></div></div></div>
<p>Setup of multilingual input for the Debian system is simplified by using the <a class="ulink" href="http://en.wikipedia.org/wiki/Intelligent_Input_Bus" target="_top">IBus</a> family of packages with the <code class="literal">im-config</code> package. The list of IBus packages are the following.</p>
<div class="table">
<a name="listofinputmethosupportswithibus"></a><p class="title"><b>Table 8.2. List of input method supports with IBus</b></p>
<div class="table-contents"><table summary="List of input method supports with IBus" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
package
</th>
<th align="left">
popcon
</th>
<th align="left">
size
</th>
<th align="left">
supported locale
</th>
</tr></thead>
<tbody>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/ibus" target="_top">
ibus
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=ibus" target="_top">http://qa.debian.org/popcon.php?package=ibus</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/i/ibus.html" target="_top">1852</a></td>
<td align="left">
input method framework using dbus
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/ibus-mozc" target="_top">
ibus-mozc
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=ibus-mozc" target="_top">http://qa.debian.org/popcon.php?package=ibus-mozc</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/i/ibus-mozc.html" target="_top">841</a></td>
<td align="left">
Japanese
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/ibus-anthy" target="_top">
ibus-anthy
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=ibus-anthy" target="_top">http://qa.debian.org/popcon.php?package=ibus-anthy</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/i/ibus-anthy.html" target="_top">626</a></td>
<td align="left">
, ,
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/ibus-skk" target="_top">
ibus-skk
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=ibus-skk" target="_top">http://qa.debian.org/popcon.php?package=ibus-skk</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/i/ibus-skk.html" target="_top">294</a></td>
<td align="left">
, ,
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/ibus-pinyin" target="_top">
ibus-pinyin
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=ibus-pinyin" target="_top">http://qa.debian.org/popcon.php?package=ibus-pinyin</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/i/ibus-pinyin.html" target="_top">1448</a></td>
<td align="left">
Chinese (for zh_CN)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/ibus-chewing" target="_top">
ibus-chewing
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=ibus-chewing" target="_top">http://qa.debian.org/popcon.php?package=ibus-chewing</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/i/ibus-chewing.html" target="_top">139</a></td>
<td align="left">
, , (for zh_TW)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/ibus-hangul" target="_top">
ibus-hangul
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=ibus-hangul" target="_top">http://qa.debian.org/popcon.php?package=ibus-hangul</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/i/ibus-hangul.html" target="_top">165</a></td>
<td align="left">
Korean
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/ibus-table" target="_top">
ibus-table
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=ibus-table" target="_top">http://qa.debian.org/popcon.php?package=ibus-table</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/i/ibus-table.html" target="_top">696</a></td>
<td align="left">
table engine for IBus
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/ibus-table-thai" target="_top">
ibus-table-thai
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=ibus-table-thai" target="_top">http://qa.debian.org/popcon.php?package=ibus-table-thai</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/i/ibus-table-thai.html" target="_top">143</a></td>
<td align="left">
Thai
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/ibus-unikey" target="_top">
ibus-unikey
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=ibus-unikey" target="_top">http://qa.debian.org/popcon.php?package=ibus-unikey</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/i/ibus-unikey.html" target="_top">224</a></td>
<td align="left">
Vietnamese
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/ibus-m17n" target="_top">
ibus-m17n
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=ibus-m17n" target="_top">http://qa.debian.org/popcon.php?package=ibus-m17n</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/i/ibus-m17n.html" target="_top">161</a></td>
<td align="left">
Multilingual: Indic, Arabic and others
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>The kinput2 method and other locale dependent Asian classic <a class="ulink" href="http://en.wikipedia.org/wiki/Input_method" target="_top">input methods</a> still exist but are not recommended for the modern UTF-8 X environment. The <a class="ulink" href="http://en.wikipedia.org/wiki/Smart_Common_Input_Method" target="_top">SCIM</a> and <a class="ulink" href="http://en.wikipedia.org/wiki/Uim" target="_top">uim</a> tool chains are an slightly older approach for the international input method for the modern UTF-8 X environment.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_an_example_for_japanese"></a>8.1.2. An example for Japanese</h3></div></div></div>
<p>I find the Japanese input method started under English environment ("<code class="literal">en_US.UTF-8</code>") very useful. Here is how I did this with IBus.</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><p>
Install the Japanese input tool package <code class="literal">ibus-mozc</code> with its recommended packages such as <code class="literal">im-config</code>.
</p></li>
<li class="listitem"><p>
Execute "<code class="literal">im-config</code>" from user's shell and select "<code class="literal">ibus</code>".
</p></li>
<li class="listitem"><p>
Select "System" → "Preferences" → "IBus Preferences" → "Input Method" → "Select an input method" → "Japanese" → "MOZC" and click "Add".
</p></li>
<li class="listitem"><p>
Relogin to user's account.
</p></li>
<li class="listitem"><p>
Verify setting by "<code class="literal">im-config</code>".
</p></li>
<li class="listitem"><p>
Setup input method and mode by right clicking GUI toolbar. (You can reduce menu choice of input method.)
</p></li>
<li class="listitem"><p>
Start IBus input method by CTRL-SPACE.
</p></li>
</ol></div>
<p>Please note the following.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">im-config</span>(8)</span> behaves differently if command is executed from root or not.
</p></li>
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">im-config</span>(8)</span> enables the best input method on the system as default without any user actions.
</p></li>
<li class="listitem"><p>
The GUI menu entry for <span class="citerefentry"><span class="refentrytitle">im-config</span>(8)</span> is disabled as default to prevent cluttering.
</p></li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_disabling_the_input_method"></a>8.1.3. Disabling the input method</h3></div></div></div>
<p>If you wish to input without going through XIM, set "<code class="literal">$XMODIFIERS</code>" value to "none" while starting a program. This may be the case if you use Japanese input infrastructure <code class="literal">egg</code> on <span class="citerefentry"><span class="refentrytitle">emacs</span>(1)</span>. From shell, execute as the following.</p>
<pre class="screen">$ XMODIFIERS=none emacs</pre>
<p>In order to adjust the command executed by the Debian menu, place customized configuration in "<code class="literal">/etc/menu/</code>" following method described in "<code class="literal">/usr/share/doc/menu/html</code>".</p>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="_the_display_output"></a>8.2. The display output</h2></div></div></div>
<p>Linux console can only display limited characters. (You need to use special terminal program such as <span class="citerefentry"><span class="refentrytitle">jfbterm</span>(1)</span> to display non-European languages on the non-X console.)</p>
<p>X Window can display any characters in the UTF-8 as long as required font data exists. (The encoding of the original font data is taken care by the X Window System and transparent to the user.)</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="_the_locale"></a>8.3. The locale</h2></div></div></div>
<p>The following focuses on the locale for applications run under X Window environment started from <span class="citerefentry"><span class="refentrytitle">gdm3</span>(1)</span>.</p>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_basics_of_encoding"></a>8.3.1. Basics of encoding</h3></div></div></div>
<p>The environment variable "<code class="literal">LANG=xx_YY.ZZZZ</code>" sets the locale to language code "<code class="literal">xx</code>", country code "<code class="literal">yy</code>", and encoding "<code class="literal">ZZZZ</code>" (see <a class="xref" href="ch01.en.html#_literal_lang_literal_variable" title='1.5.2. "$LANG" variable'>Section 1.5.2, “"<code class="literal">$LANG</code>" variable”</a>).</p>
<p>Current Debian system normally sets the locale as "<code class="literal">LANG=xx_YY.UTF-8</code>". This uses the <a class="ulink" href="http://en.wikipedia.org/wiki/UTF-8" target="_top">UTF-8</a> encoding with the <a class="ulink" href="http://en.wikipedia.org/wiki/Unicode" target="_top">Unicode</a> character set. This <a class="ulink" href="http://en.wikipedia.org/wiki/UTF-8" target="_top">UTF-8</a> encoding system is a multibyte code system and uses code points smartly. The <a class="ulink" href="http://en.wikipedia.org/wiki/ASCII" target="_top">ASCII</a> data, which consist only with 7-bit range codes, are always valid UTF-8 data consisting only with 1 byte per character.</p>
<p>Previous Debian system used to set the locale as "<code class="literal">LANG=C</code>" or "<code class="literal">LANG=xx_YY</code>" (without "<code class="literal">.UTF-8</code>").</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
The <a class="ulink" href="http://en.wikipedia.org/wiki/ASCII" target="_top">ASCII</a> character set is used for "<code class="literal">LANG=C</code>" or "<code class="literal">LANG=POSIX</code>".
</p></li>
<li class="listitem"><p>
The traditional encoding system in Unix is used for "<code class="literal">LANG=xx_YY</code>".
</p></li>
</ul></div>
<p>Actual traditional encoding system used for "<code class="literal">LANG=xx_YY</code>" can be identified by checking "<code class="literal">/usr/share/i18n/SUPPORTED</code>". For example, "<code class="literal">en_US</code>" uses "<code class="literal">ISO-8859-1</code>" encoding and "<code class="literal">fr_FR@euro</code>" uses "<code class="literal">ISO-8859-15</code>" encoding.</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>For meaning of encoding values, see <a class="xref" href="ch11.en.html#list-of-encoding-values" title="Table 11.2. List of encoding values and their usage">Table 11.2, “List of encoding values and their usage”</a>.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_rationale_for_utf_8_locale"></a>8.3.2. Rationale for UTF-8 locale</h3></div></div></div>
<p>The <a class="ulink" href="http://en.wikipedia.org/wiki/UTF-8" target="_top">UTF-8</a> encoding is the modern and sensible text encoding system for I18N and enables to represent <a class="ulink" href="http://en.wikipedia.org/wiki/Unicode" target="_top">Unicode</a> characters, i.e., practically all characters known to human. <span class="strong"><strong>UTF</strong></span> stands for Unicode Transformation Format (UTF) schemes.</p>
<p>I recommend to use <a class="ulink" href="http://en.wikipedia.org/wiki/UTF-8" target="_top">UTF-8</a> locale for your desktop, e.g., "<code class="literal">LANG=en_US.UTF-8</code>". The first part of the locale determines messages presented by applications. For example, <span class="citerefentry"><span class="refentrytitle">gedit</span>(1)</span> (text editor for the GNOME Desktop) under "<code class="literal">LANG=fr_FR.UTF-8</code>" locale can display and edit Chinese character text data while presenting menus in French, as long as required fonts and input methods are installed.</p>
<p>I also recommend to set the locale only using the "<code class="literal">$LANG</code>" environment variable. I do not see much benefit of setting a complicated combination of "<code class="literal">LC_*</code>" variables (see <span class="citerefentry"><span class="refentrytitle">locale</span>(1)</span>) under UTF-8 locale.</p>
<p>Even plain English text may contain non-ASCII characters, e.g. left and right quotation marks are not available in ASCII.</p>
<pre class="screen">“double quoted text”
single quoted text</pre>
<p>When <a class="ulink" href="http://en.wikipedia.org/wiki/ASCII" target="_top">ASCII</a> plain text data is converted to <a class="ulink" href="http://en.wikipedia.org/wiki/UTF-8" target="_top">UTF-8</a> one, it has exactly the same content and size as the original ASCII one. So you loose nothing by deploying UTF-8 locale.</p>
<p>Some programs consume more memory after supporting I18N. This is because they are coded to use <a class="ulink" href="http://en.wikipedia.org/wiki/UTF-32/UCS-4" target="_top">UTF-32(UCS4)</a> internally to support Unicode for speed optimization and consume 4 bytes per each ASCII character data independent of locale selected. Again, you loose nothing by deploying UTF-8 locale.</p>
<p>The vendor specific old non-UTF-8 encoding systems tend to have minor but annoying differences on some characters such as graphic ones for many countries. The deployment of the UTF-8 system by the modern OSs practically solved these conflicting encoding issues.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_the_reconfiguration_of_the_locale"></a>8.3.3. The reconfiguration of the locale</h3></div></div></div>
<p>In order for the system to access a particular locale, the locale data must be compiled from the locale database. (The Debian system does <span class="strong"><strong>not</strong></span> come with all available locales pre-compiled unless you installed the <code class="literal">locales-all</code> package.) The full list of supported locales available for compiling are listed in "<code class="literal">/usr/share/i18n/SUPPORTED</code>". This lists all the proper locale names. The following lists all the available UTF-8 locales already compiled to the binary form.</p>
<pre class="screen">$ locale -a | grep utf8</pre>
<p>The following command execution reconfigures the <code class="literal">locales</code> package.</p>
<pre class="screen"># dpkg-reconfigure locales</pre>
<p>This process involves 3 steps.</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><p>
Update the list of available locales
</p></li>
<li class="listitem"><p>
Compile them into the binary form
</p></li>
<li class="listitem"><p>
Set the system wide default locale value in the "<code class="literal">/etc/defaults/locale</code>" for use by PAM (see <a class="xref" href="ch04.en.html#_pam_and_nss" title="4.5. PAM and NSS">Section 4.5, “PAM and NSS”</a>)
</p></li>
</ol></div>
<p>The list of available locale should include "<code class="literal">en_US.UTF-8</code>" and all the interesting languages with "<code class="literal">UTF-8</code>".</p>
<p>The recommended default locale is "<code class="literal">en_US.UTF-8</code>" for US English. For other languages, please make sure to chose locale with "<code class="literal">UTF-8</code>". Any one of these settings can handle any international characters.</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>Although setting locale to "<code class="literal">C</code>" uses US English message, it handles only ASCII characters.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_the_value_of_the_literal_lang_literal_environment_variable"></a>8.3.4. The value of the "<code class="literal">$LANG</code>" environment variable</h3></div></div></div>
<p>The value of the "<code class="literal">$LANG</code>" environment variable is set and changed by many applications.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
Set initially by the PAM mechanism of <span class="citerefentry"><span class="refentrytitle">login</span>(1)</span> for the local Linux console programs
</p></li>
<li class="listitem"><p>
Set initially by the PAM mechanism of the display manager for all X programs
</p></li>
<li class="listitem"><p>
Set initially by the PAM mechanism of <span class="citerefentry"><span class="refentrytitle">ssh</span>(1)</span> for the remote console programs
</p></li>
<li class="listitem"><p>
Changed by some display manager such as <span class="citerefentry"><span class="refentrytitle">gdm3</span>(1)</span> for all X programs
</p></li>
<li class="listitem"><p>
Changed by the X session startup code via "<code class="literal">~/.xsessionrc</code>" for all X programs (<code class="literal">lenny</code> feature)
</p></li>
<li class="listitem"><p>
Changed by the shell startup code, e.g. "<code class="literal">~/.bashrc</code>", for all console programs
</p></li>
</ul></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>It is good idea to install system wide default locale as "<code class="literal">en_US.UTF-8</code>" for maximum compatibility.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_specific_locale_only_under_x_window"></a>8.3.5. Specific locale only under X Window</h3></div></div></div>
<p>You can chose specific locale only under X Window irrespective of your system wide default locale using PAM customization (see <a class="xref" href="ch04.en.html#_pam_and_nss" title="4.5. PAM and NSS">Section 4.5, “PAM and NSS”</a>) as follows.</p>
<p>This environment should provide you with your best desktop experience with stability. You have access to the functioning character terminal with readable messages even when the X Window System is not working. This becomes essential for languages which use non-roman characters such as Chinese, Japanese, and Korean.</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>There may be another way available as the improvement of X session manager package but please read following as the generic and basic method of setting the locale. For <span class="citerefentry"><span class="refentrytitle">gdm3</span>(1)</span>, I know you can select the locale of X session via its memu.</p></td></tr>
</table></div>
<p>The following line defines file location of the language environment in the PAM configuration file, such as "<code class="literal">/etc/pam.d/gdm3</code>.</p>
<pre class="screen">auth required pam_env.so read_env=1 envfile=/etc/default/locale</pre>
<p>Change this to the following.</p>
<pre class="screen">auth required pam_env.so read_env=1 envfile=/etc/default/locale-x</pre>
<p>For Japanese, create a "<code class="literal">/etc/defaults/locale-x</code>" file with "<code class="literal">-rw-r--r-- 1 root root</code>" permission containing the following.</p>
<pre class="screen">LANG="ja_JP.UTF-8"</pre>
<p>Keep the default "<code class="literal">/etc/defaults/locale</code>" file for other programs as the the following.</p>
<pre class="screen">LANG="en_US.UTF-8"</pre>
<p>This is the most generic technique to customize locale and makes the menu selection dialog of <span class="citerefentry"><span class="refentrytitle">gdm3</span>(1)</span> itself to be localized.</p>
<p>Alternatively for this case, you may simply change locale using the "<code class="literal">~/.xsessionrc</code>" file.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_filename_encoding"></a>8.3.6. Filename encoding</h3></div></div></div>
<p>For cross platform data exchanges (see <a class="xref" href="ch10.en.html#_removable_storage_device" title="10.1.10. Removable storage device">Section 10.1.10, “Removable storage device”</a>), you may need to mount some filesystem with particular encodings. For example, <span class="citerefentry"><span class="refentrytitle">mount</span>(8)</span> for <a class="ulink" href="http://en.wikipedia.org/wiki/File_Allocation_Table" target="_top">vfat filesystem</a> assumes <a class="ulink" href="http://en.wikipedia.org/wiki/Code_page_437" target="_top">CP437</a> if used without option. You need to provide
explicit mount option to use <a class="ulink" href="http://en.wikipedia.org/wiki/UTF-8" target="_top">UTF-8</a> or <a class="ulink" href="http://en.wikipedia.org/wiki/Code_page_932" target="_top">CP932</a> for filenames.</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>When auto-mounting a hot-pluggable USB memory stick under modern desktop environment such as GNOME, you may provide such mount option by right clicking the icon on the desktop, click "Drive" tab, click to expand "Setting", and entering "utf8" to "Mount options:". The next time this memory stick is mounted, mount with UTF-8 is enabled.</p></td></tr>
</table></div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>If you are upgrading system or moving disk drives from older non-UTF-8 system, file names with non-ASCII characters may be encoded in the historic and deprecated encodings such as <a class="ulink" href="http://en.wikipedia.org/wiki/ISO/IEC_8859-1" target="_top">ISO-8859-1</a> or <a class="ulink" href="http://en.wikipedia.org/wiki/Extended_Unix_Code" target="_top">eucJP</a>. Please seek help of text conversion tools to convert them to <a class="ulink" href="http://en.wikipedia.org/wiki/UTF-8" target="_top">UTF-8</a>. See <a class="xref" href="ch11.en.html#_text_data_conversion_tools" title="11.1. Text data conversion tools">Section 11.1, “Text data conversion tools”</a>.</p></td></tr>
</table></div>
<p><a class="ulink" href="http://en.wikipedia.org/wiki/Samba_(software)" target="_top">Samba</a> uses Unicode for newer clients (Windows NT, 200x, XP) but uses <a class="ulink" href="http://en.wikipedia.org/wiki/Code_page_850" target="_top">CP850</a> for older clients (DOS and Windows 9x/Me) as default. This default for older clients can be changed using "<code class="literal">dos charset</code>" in the "<code class="literal">/etc/samba/smb.conf</code>" file, e.g., to <a class="ulink" href="http://en.wikipedia.org/wiki/Code_page_932" target="_top">CP932</a> for Japanese.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_localized_messages_and_translated_documentation"></a>8.3.7. Localized messages and translated documentation</h3></div></div></div>
<p>Translations exist for many of the text messages and documents that are displayed in the Debian system, such as error messages, standard program output, menus, and manual pages. <a class="ulink" href="http://en.wikipedia.org/wiki/Gettext" target="_top">GNU gettext(1) command tool chain</a> is used as the backend tool for most translation activities.</p>
<p><span class="citerefentry"><span class="refentrytitle">aptitude</span>(8)</span> lists under "Tasks" → "Localization" provide extensive list of useful binary packages which add localized messages to applications and provide translated documentation.</p>
<p>For example, you can obtain the localized message for manpage by installing the <code class="literal">manpages-&lt;LANG&gt;</code> package. To read the Italian-language manpage for &lt;programname&gt; from "<code class="literal">/usr/share/man/it/</code>", execute as the following.</p>
<pre class="screen">LANG=it_IT.UTF-8 man &lt;programname&gt;</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_effects_of_the_locale"></a>8.3.8. Effects of the locale</h3></div></div></div>
<p>The sort order of characters with <span class="citerefentry"><span class="refentrytitle">sort</span>(1)</span> is affected by the language choice of the locale. Spanish and English locale sort differently.</p>
<p>The date format of <span class="citerefentry"><span class="refentrytitle">ls</span>(1)</span> is affected by the locale. The date format of "<code class="literal">LANG=C ls -l</code>" and "<code class="literal">LANG=en_US.UTF-8</code>" are different (see <a class="xref" href="ch09.en.html#_customized_display_of_time_and_date" title="9.2.5. Customized display of time and date">Section 9.2.5, “Customized display of time and date”</a>).</p>
<p>Number punctuation are different for locales. For example, in English locale, one thousand one point one is displayed as "<code class="literal">1,000.1</code>" while in German locale, it is displayed as "<code class="literal">1.000,1</code>". You may see this difference in spreadsheet program.</p>
</div>
</div>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="ch07.en.html"><img src="images/prev.gif" alt="Prev"></a> </td>
<td width="20%" align="center"> </td>
<td width="40%" align="right"> <a accesskey="n" href="ch09.en.html"><img src="images/next.gif" alt="Next"></a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Chapter 7. The X Window System </td>
<td width="20%" align="center"><a accesskey="h" href="index.en.html"><img src="images/home.gif" alt="Home"></a></td>
<td width="40%" align="right" valign="top"> Chapter 9. System tips</td>
</tr>
</table>
</div>
</body>
</html>