📄 using-localization.html
字号:
<div class="SECT4"><h4 class="SECT4"><a id="STARTUP-FILE" name="STARTUP-FILE">18.3.4.1.2 Shell Startup FileMethod</a></h4><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> This method is not recommended because it requires a different setup foreach possible shell program chosen. Use the <ahref="using-localization.html#LOGIN-CLASS">Login Class Method</a> instead.</p></blockquote></div><p>To add the locale name and MIME character set, just set the two environment variablesshown below in the <tt class="FILENAME">/etc/profile</tt> and/or <ttclass="FILENAME">/etc/csh.login</tt> shell startup files. We will use the German languageas an example below:</p><p>In <tt class="FILENAME">/etc/profile</tt>:</p><pre class="PROGRAMLISTING"><tt class="ENVAR">LANG=de_DE.ISO8859-1; export LANG</tt><tt class="ENVAR">MM_CHARSET=ISO-8859-1; export MM_CHARSET</tt></pre><p>Or in <tt class="FILENAME">/etc/csh.login</tt>:</p><pre class="PROGRAMLISTING"><tt class="ENVAR">setenv LANG de_DE.ISO8859-1</tt><tt class="ENVAR">setenv MM_CHARSET ISO-8859-1</tt></pre><p>Alternatively, you can add the above instructions to <ttclass="FILENAME">/usr/share/skel/dot.profile</tt> (similar to what was used in <ttclass="FILENAME">/etc/profile</tt> above), or <ttclass="FILENAME">/usr/share/skel/dot.login</tt> (similar to what was used in <ttclass="FILENAME">/etc/csh.login</tt> above).</p><p>For X11:</p><p>In <tt class="FILENAME">$HOME/.xinitrc</tt>:</p><pre class="PROGRAMLISTING"><tt class="ENVAR">LANG=de_DE.ISO8859-1; export LANG</tt></pre><p>Or:</p><pre class="PROGRAMLISTING"><tt class="ENVAR">setenv LANG de_DE.ISO8859-1</tt></pre><p>Depending on your shell (see above).</p></div></div></div><div class="SECT2"><h2 class="SECT2"><a id="SETTING-CONSOLE" name="SETTING-CONSOLE">18.3.5 ConsoleSetup</a></h2><p>For all single C chars character sets, set the correct console fonts in <ttclass="FILENAME">/etc/rc.conf</tt> for the language in question with:</p><pre class="PROGRAMLISTING">font8x16=<var class="REPLACEABLE">font_name</var>font8x14=<var class="REPLACEABLE">font_name</var>font8x8=<var class="REPLACEABLE">font_name</var></pre><p>The <var class="REPLACEABLE">font_name</var> here is taken from the <ttclass="FILENAME">/usr/share/syscons/fonts</tt> directory, without the <ttclass="FILENAME">.fnt</tt> suffix.</p><p>Also be sure to set the correct keymap and screenmap for your single C chars characterset through <tt class="FILENAME">/stand/sysinstall</tt>. Once inside <bclass="APPLICATION">sysinstall</b>, choose <span class="GUIMENUITEM">Configure</span>,then <span class="GUIMENUITEM">Console</span>. Alternatively, you can add the followingto <tt class="FILENAME">/etc/rc.conf</tt>:</p><pre class="PROGRAMLISTING">scrnmap=<var class="REPLACEABLE">screenmap_name</var>keymap=<var class="REPLACEABLE">keymap_name</var>keychange="<var class="REPLACEABLE">fkey_number sequence</var>"</pre><p>The <var class="REPLACEABLE">screenmap_name</var> here is taken from the <ttclass="FILENAME">/usr/share/syscons/scrnmaps</tt> directory, without the <ttclass="FILENAME">.scm</tt> suffix. A screenmap with a corresponding mapped font isusually needed as a workaround for expanding bit 8 to bit 9 on a VGA adapter's fontcharacter matrix in pseudographics area, i.e., to move letters out of that area if screenfont uses a bit 8 column.</p><p>If you have the <b class="APPLICATION">moused</b> daemon enabled by setting thefollowing in your <tt class="FILENAME">/etc/rc.conf</tt>:</p><pre class="PROGRAMLISTING">moused_enable="YES"</pre><p>then examine the mouse cursor information in the next paragraph.</p><p>By default the mouse cursor of the <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=syscons&sektion=4"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">syscons</span>(4)</span></a> driveroccupies the 0xd0-0xd3 range in the character set. If your language uses this range, youneed to move the cursor's range outside of it. To enable the workaround for FreeBSDversions before 5.0, insert the following line into your kernel configuration:</p><pre class="PROGRAMLISTING">options SC_MOUSE_CHAR=0x03</pre><p>For FreeBSD versions 4.4 and up insert the following line into <ttclass="FILENAME">/etc/rc.conf</tt>:</p><pre class="PROGRAMLISTING">mousechar_start=3</pre><p>The <var class="REPLACEABLE">keymap_name</var> here is taken from the <ttclass="FILENAME">/usr/share/syscons/keymaps</tt> directory, without the <ttclass="FILENAME">.kbd</tt> suffix. If you're uncertain which keymap to use, you use can<a href="http://www.FreeBSD.org/cgi/man.cgi?query=kbdmap&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">kbdmap</span>(1)</span></a> to testkeymaps without rebooting.</p><p>The <var class="LITERAL">keychange</var> is usually needed to program function keys tomatch the selected terminal type because function key sequences cannot be defined in thekey map.</p><p>Also be sure to set the correct console terminal type in <ttclass="FILENAME">/etc/ttys</tt> for all <var class="LITERAL">ttyv*</var> entries. Currentpre-defined correspondences are:</p><div class="INFORMALTABLE"><a id="AEN26870" name="AEN26870"></a><table border="0" frame="void" class="CALSTABLE"><col /><col /><thead><tr><th>Character Set</th><th>Terminal Type</th></tr></thead><tbody><tr><td>ISO-8859-1 or ISO-8859-15</td><td><var class="LITERAL">cons25l1</var></td></tr><tr><td>ISO-8859-2</td><td><var class="LITERAL">cons25l2</var></td></tr><tr><td>ISO-8859-7</td><td><var class="LITERAL">cons25l7</var></td></tr><tr><td>KOI8-R</td><td><var class="LITERAL">cons25r</var></td></tr><tr><td>KOI8-U</td><td><var class="LITERAL">cons25u</var></td></tr><tr><td>CP437 (VGA default)</td><td><var class="LITERAL">cons25</var></td></tr><tr><td>US-ASCII</td><td><var class="LITERAL">cons25w</var></td></tr></tbody></table></div><p>For wide or multibyte characters languages, use the correct FreeBSD port in your <ttclass="FILENAME">/usr/ports/<var class="REPLACEABLE">language</var></tt> directory. Someports appear as console while the system sees it as serial vtty's, hence you must reserveenough vtty's for both X11 and the pseudo-serial console. Here is a partial list ofapplications for using other languages in console:</p><div class="INFORMALTABLE"><a id="AEN26908" name="AEN26908"></a><table border="0" frame="void" class="CALSTABLE"><col /><col /><thead><tr><th>Language</th><th>Location</th></tr></thead><tbody><tr><td>Traditional Chinese (BIG-5)</td><td><a href="http://www.FreeBSD.org/cgi/url.cgi?ports/chinese/big5con/pkg-descr"><ttclass="FILENAME">chinese/big5con</tt></a></td></tr><tr><td>Japanese</td><td><a href="http://www.FreeBSD.org/cgi/url.cgi?ports/japanese/kon2-16dot/pkg-descr"><ttclass="FILENAME">japanese/kon2-16dot</tt></a> or <ahref="http://www.FreeBSD.org/cgi/url.cgi?ports/japanese/mule-freewnn/pkg-descr"><ttclass="FILENAME">japanese/mule-freewnn</tt></a></td></tr><tr><td>Korean</td><td><a href="http://www.FreeBSD.org/cgi/url.cgi?ports/korean/han/pkg-descr"><ttclass="FILENAME">korean/han</tt></a></td></tr></tbody></table></div></div><div class="SECT2"><h2 class="SECT2"><a id="AEN26928" name="AEN26928">18.3.6 X11 Setup</a></h2><p>Although X11 is not part of the FreeBSD Project, we have included some informationhere for FreeBSD users. For more details, refer to the <a href="http://www.xfree86.org/"target="_top"><span class="TRADEMARK">XFree86</span>™ web site</a> or whichever X11Server you use.</p><p>In <tt class="FILENAME">~/.Xresources</tt>, you can additionally tune applicationspecific I18N settings (e.g., fonts, menus, etc.).</p><div class="SECT3"><h3 class="SECT3"><a id="AEN26935" name="AEN26935">18.3.6.1 Displaying Fonts</a></h3><p>Install the X11 <span class="TRADEMARK">TrueType</span>® Common server (<ahref="http://www.FreeBSD.org/cgi/url.cgi?ports/x11-servers/XttXF86srv-common/pkg-descr"><tt class="FILENAME">x11-servers/XttXF86srv-common</tt></a>) and install the language <spanclass="TRADEMARK">TrueType</span> fonts. Setting the correct locale should allow you toview your selected language in menus and such.</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN26943" name="AEN26943">18.3.6.2 Inputting Non-EnglishCharacters</a></h3><p>The X11 Input Method (XIM) Protocol is a new standard for all X11 clients. All X11applications should be written as XIM clients that take input from XIM Input servers.There are several XIM servers available for different languages.</p></div></div><div class="SECT2"><h2 class="SECT2"><a id="AEN26948" name="AEN26948">18.3.7 Printer Setup</a></h2><p>Some single C chars character sets are usually hardware coded into printers. Wide ormultibyte character sets require special setup and we recommend using <bclass="APPLICATION">apsfilter</b>. You may also convert the document to <spanclass="TRADEMARK">PostScript</span>® or PDF formats using language specificconverters.</p></div><div class="SECT2"><h2 class="SECT2"><a id="AEN26953" name="AEN26953">18.3.8 Kernel and FileSystems</a></h2><p>The FreeBSD fast filesystem (FFS) is 8-bit clean, so it can be used with any single Cchars character set (see <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=multibyte&sektion=3"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">multibyte</span>(3)</span></a>), butthere is no character set name stored in the filesystem; i.e., it is raw 8-bit and doesnot know anything about encoding order. Officially, FFS does not support any form of wideor multibyte character sets yet. However, some wide or multibyte character sets haveindependent patches for FFS enabling such support. They are only temporary unportablesolutions or hacks and we have decided to not include them in the source tree. Refer torespective languages' web sites for more informations and the patch files.</p><p>The FreeBSD <span class="TRADEMARK">MS-DOS</span>® filesystem has the configurableability to convert between <span class="TRADEMARK">MS-DOS</span>, Unicode character setsand chosen FreeBSD filesystem character sets. See <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=mount_msdos&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">mount_msdos</span>(8)</span></a> fordetails.</p></div></div><div class="NAVFOOTER"><hr align="LEFT" width="100%" /><table summary="Footer navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><td width="33%" align="left" valign="top"><a href="l10n-basics.html"accesskey="P">Prev</a></td><td width="34%" align="center" valign="top"><a href="index.html"accesskey="H">Home</a></td><td width="33%" align="right" valign="top"><a href="l10n-compiling.html"accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">The Basics</td><td width="34%" align="center" valign="top"><a href="l10n.html" accesskey="U">Up</a></td><td width="33%" align="right" valign="top">Compiling I18N Programs</td></tr></table></div><p align="center"><small>This, and other documents, can be downloaded from <ahref="ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/">ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/</a>.</small></p><p align="center"><small>For questions about FreeBSD, read the <ahref="http://www.FreeBSD.org/docs.html">documentation</a> before contacting <<ahref="mailto:questions@FreeBSD.org">questions@FreeBSD.org</a>>.<br />For questions about this documentation, e-mail <<ahref="mailto:doc@FreeBSD.org">doc@FreeBSD.org</a>>.</small></p></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -