aboutsummaryrefslogblamecommitdiff
path: root/en_US.ISO8859-1/books/handbook/l10n/chapter.xml
blob: a3f47526a36fa5f72214bad01eebb8a64da8cd27 (plain) (tree)
1
2
3
4
5
6
7
                                           


                                      
              
   
                                                                                                                      




                                                               
                 

                                                                                                                  

                  


                                                                          

                         
         
 
                                

                           
                                                                   
                                                                      




                                                                      
 

                                             
                               





















                                                                      
 
                                                           
 
                  



                                                                
 


                                                             
 



                                                          
 
                
                                                                    

                                          
 



                                                                
                   
 
                                                         

                  


                                                               
                   

          
                                     

                                     
                                                    
 

                                                                      
                                                     
 
                                                                                                                                                       
 

                                                              
 




                                                                                              
 

                                                                  
 


                         
                                                      





                                        
                                  
                                                   


                  
                                  
                                            


                  
                                  
                                                        


                  
              
 

                                                         
 



                                                                    
                                                                   

                                                                  




                                                                      
 
                                                                   
                      
 
                                                                            
 
                                                           
 
                                                                  
 
                                   
                                                   
 

                                                             
                                                   
                                        
                                          
                                             
 

                                       

                    
                  
                                                                     
                                                       
                   
 
                  

                                                        

                                                             

                     
 


                                                                
                                                             
 























                                                                    
                             
                                               
 








                                                                    
 
                                                                                    
                                            
    
                          
                                   
                                       




                                        
                       
                                                                                  
 



                                                                   
 
                                                                                                                      

                                                          

                                     

                                                              
 
                                                      
                             
                               
                                     
 










                                                                                      
 


                                                      
 



                                                                   
 


                                                                      
 
                                                                                                                                     
 



                                                               
 


                                                                     
 


                                                           
 

                                                                     
 
                                                                          
 

                                                          
 
                                                                                       
 


                                                    
 

                                                                  
 
                                                                                                

                  
 
                                     
                                                  
 





                                                                      
                                                          


                                                                   
 
                                                                          
                                                                        
 





                                                                     
 
                                                                    
                                                            
 




                                                                      
                         
 
                                                                                           
 
                                                                                     
              
            
 
                                    
                                  
 

                                                                      


                                                                     

                                                        
 
                                                                   


                                                             

                                                         

                                                              
 
                                                                       

                                                                            
 
                                                         






                                                                      
 

                                                                 



                                                                     
 



                                                                    
 
                                                          
                                                               

                                                                 


                                                                
 









                                          
                                                    



                                                        
                                      



                                                        
                                      



                                                        




                                                       
                                   
                                                       


                  
                                                

                                                      




                                                       

                  











                                                                      
 

                                                              
 



                                     
                                          





                                                        
                                                               


                  




                                                           
                                     





                                                             


                  






                                                                   


                  

              
                                                              
                                                                   








                                                                    

           
                               
 



                                                                    














                                                                      














































                                                                    
 












                                                                   
                  



                                                              
                  



                                                                
                  








                                                                   
                  



                                                                    
                  











































                                                                                  

                  









































                                                                   
            

                                                                             


                                  




                                                                 
                                   
            
       


                                            







                                                                      

                                                                    
 

                                                       



                                                                  
            

          
                                 
                                                             
 






                                                                      
 
                                                 
 





                                                                     
 



                                                                      
 


                                                                        
 


                                                                      
 



                                                                     
 





                                                                  



                                                         
                                            
                                                         
                                                                

                                                            
                                                                

          
                             
                                                              
 
                                                                     

                                                                    
 
                                


                                                         
                     

                                                                                                                     
                      
             
 



                                       
 


                                                                     
 
                                     

                                            
 

                                                                
 
                                        


                      

                                  
 


                                                               
 







                                                                      
 
                                                     


                                                                                     

                                                         
 



                                                                  
 
                                                                                           
 
                                                                   
 






                                                                    
 
                                                                                     
 

                                                                
 


                                                                    
 
                                                  
                                                  
 


































                                                                                    
                                                      
                                                  
            
 
           
                                                           
 
                                          
 



                                                  
                 

                                       

                  

                                       
                  







                                       
 

























































                                                                                                                                                                                    
                                                                      



                                                            


            
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
     The FreeBSD Documentation Project

     $FreeBSD$
-->
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:id="l10n">
  <info>
    <title>Localization -
      <acronym>i18n</acronym>/<acronym>L10n</acronym> Usage and
      Setup</title>

    <authorgroup>
      <author><personname><firstname>Andrey</firstname><surname>Chernov</surname></personname><contrib>Contributed
	by </contrib></author>
    </authorgroup>
    <authorgroup>
      <author><personname><firstname>Michael
	C.</firstname><surname>Wu</surname></personname><contrib>Rewritten
	by </contrib></author>
      <!-- 30 Nv 2000 -->
    </authorgroup>
  </info>

  <sect1 xml:id="l10n-synopsis">
    <title>Synopsis</title>

    <para>&os; is a distributed project with users and contributors
      located all over the world.  As such, &os; supports localization
      into many languages.  This allows a user to view, input, or
      process data in non-English languages.  Currently, one can
      choose from most of the major languages, including but not
      limited to:  Chinese, German, Japanese, Korean, French, Russian,
      and Vietnamese.</para>

    <indexterm>
      <primary>internationalization</primary>
	<see>localization</see>
    </indexterm>
    <indexterm><primary>localization</primary></indexterm>

    <para>The term internationalization has been shortened to
      <acronym>i18n</acronym>, which represents the number of letters
      between the first and the last letters of internationalization.
      <acronym>L10n</acronym> uses the same naming scheme, coming from
      <quote>localization</quote>.  Combined together,
      <acronym>i18n</acronym>/<acronym>L10n</acronym> methods,
      protocols, and applications allow users to use languages of
      their choice.</para>

    <para><acronym>i18n</acronym> applications are programmed using
      <acronym>i18n</acronym> kits under libraries.  These allow
      developers to write a simple file and translate displayed menus
      and texts to each language.</para>

    <para>This chapter discusses the internationalization and
      localization features of &os;.  Since there are many aspects of
      the <acronym>i18n</acronym> implementation at both the system
      and application levels, more specific sources of documentation
      are referred to, where applicable.</para>

    <para>After reading this chapter, you will know:</para>

    <itemizedlist>
      <listitem>
	<para>How different languages and locales are encoded on
	  modern operating systems.</para>
      </listitem>

      <listitem>
	<para>How to set the locale for a login shell.</para>
      </listitem>

      <listitem>
	<para>How to configure the console for non-English
	  languages.</para>
      </listitem>

      <listitem>
	<para>How to use <application>Xorg</application> effectively
	  with different languages.</para>
      </listitem>

      <listitem>
	<para>Where to find more information about writing
	  <acronym>i18n</acronym>-compliant applications.</para>
      </listitem>
    </itemizedlist>

    <para>Before reading this chapter, you should:</para>

    <itemizedlist>
      <listitem><para>Know how to <link linkend="ports">install
	  additional third-party
	  applications</link>.</para></listitem>
    </itemizedlist>
  </sect1>

  <sect1 xml:id="using-localization">
    <title>Using Localization</title>

    <indexterm><primary>locale</primary></indexterm>

    <para>Localization settings are based on three components:
      the language code, country code, and encoding.  Locale names are
      constructed from these parts as follows:</para>

    <programlisting><replaceable>LanguageCode</replaceable>_<replaceable>CountryCode</replaceable>.<replaceable>Encoding</replaceable></programlisting>

      <indexterm><primary>language codes</primary></indexterm>
      <indexterm><primary>country codes</primary></indexterm>

      <para>The <replaceable>LanguageCode</replaceable> and
	<replaceable>CountryCode</replaceable> are used to determine
	the country and the specific language variation.  <xref
	  linkend="locale-lang-country"/> provides some examples of
	<replaceable>LanguageCode</replaceable>_<replaceable>CountryCode</replaceable>:</para>

      <table xml:id="locale-lang-country" frame="none" pgwide="1">
	<title>Common Language and Country Codes</title>

	<tgroup cols="2">
	  <thead>
	    <row>
	      <entry>LanguageCode_Country Code</entry>
	      <entry>Description</entry>
	    </row>
	  </thead>

	  <tbody>
	    <row>
	      <entry>en_US</entry>
	      <entry>English, United States</entry>
	    </row>

	    <row>
	      <entry>ru_RU</entry>
	      <entry>Russian, Russia</entry>
	    </row>

	    <row>
	      <entry>zh_TW</entry>
	      <entry>Traditional Chinese, Taiwan</entry>
	    </row>
	  </tbody>
	</tgroup>
      </table>

      <indexterm><primary>encodings</primary></indexterm>
      <indexterm><primary>ASCII</primary></indexterm>

      <para>Some languages, such as Chinese or Japanese, cannot be
	represented using ASCII characters and require an extended
	language encoding using either wide or multibyte characters.
	Older applications may mistake these encodings for control
	characters while newer applications usually recognize 8-bit
	characters.  Depending on the implementation, users may be
	required to compile an application with wide or multibyte
	character support, or configure it correctly.  The rest of
	this section describes the various methods for configuring the
	locale on a &os; system.  The next section will discuss the
	considerations for finding or compiling applications with i18n
	support.</para>

      <para>A complete listing of available locales can be found by
	typing:</para>

      <screen>&prompt.user; <userinput>locale -a | more</userinput></screen>

      <para>To determine the current locale setting:</para>

      <screen>&prompt.user; <userinput>locale</userinput></screen>

    <sect2 xml:id="setting-locale">
      <title>Setting Locale for Login Shell</title>

      <para>Locale settings are configured either in a user's
	<filename>~/.login_conf</filename>
	or in the startup file of the user's shell:
	<filename>~/.profile</filename>,
	<filename>~/.bashrc</filename>, or
	<filename>~/.cshrc</filename>.</para>

      <para>Two environment
	variables should be set:</para>

      <itemizedlist>
	<listitem>
	  <para><envar>LANG</envar>, which sets the locale<indexterm>
	    <primary>POSIX</primary></indexterm></para>
	</listitem>

	<listitem>
	  <indexterm><primary>MIME</primary></indexterm>

	  <para><envar>MM_CHARSET</envar> which sets the MIME
	    character set used by applications</para>
	</listitem>
      </itemizedlist>

      <para>In addition to the user's shell configuration, these
	variables should also be set for
	specific application configuration and
	<application>Xorg</application> configuration.</para>

      <indexterm><primary>locale</primary></indexterm>
      <indexterm><primary>login class</primary></indexterm>

      <para>Two methods are available for making the needed variable
	assignments: the <link linkend="login-class">login
	  class</link> method, which is the recommended method, and
	the <link linkend="startup-file">startup file</link> method.
	The next two sections demonstrate how to use both
	methods.</para>

      <sect3 xml:id="login-class">
	<title>Login Classes Method</title>

	<para>This first method is the recommended method as it
	  assigns the required environment variables for locale name
	  and MIME character sets for every possible shell.  This
	  setup can either be performed by each user or it can be
	  configured for all users by the superuser.</para>

	<para>This minimal example sets both variables for Latin-1
	  encoding in the <filename>.login_conf</filename> of an
	  individual user's home directory:</para>

	<programlisting>me:\
	:charset=ISO-8859-1:\
	:lang=de_DE.ISO8859-1:</programlisting>

	<indexterm><primary>Traditional Chinese</primary>
	  <secondary>BIG-5 encoding</secondary></indexterm>

	<para>Here is an example of a user's
	  <filename>~/.login_conf</filename> that sets the variables
	  for Traditional Chinese in BIG-5 encoding.  More variables
	  are needed because some applications do not correctly
	  respect locale variables for Chinese, Japanese, and
	  Korean:</para>

	<programlisting>#Users who do not wish to use monetary units or time formats
#of Taiwan can manually change each variable
me:\
	:lang=zh_TW.Big5:\
	:setenv=LC_ALL=zh_TW.Big5:\
	:setenv=LC_COLLATE=zh_TW.Big5:\
	:setenv=LC_CTYPE=zh_TW.Big5:\
	:setenv=LC_MESSAGES=zh_TW.Big5:\
	:setenv=LC_MONETARY=zh_TW.Big5:\
	:setenv=LC_NUMERIC=zh_TW.Big5:\
	:setenv=LC_TIME=zh_TW.Big5:\
	:charset=big5:\
	:xmodifiers="@im=gcin": #Set gcin as the XIM Input Server</programlisting>

	<para>Alternately, the superuser can configure all users of
	  the system for localization.  The following variables in
	  <filename>/etc/login.conf</filename> are used to set the
	  locale and MIME character sete:</para>

	<programlisting><replaceable>language_name</replaceable>|<replaceable>Account Type Description</replaceable>:\
	:charset=<replaceable>MIME_charset</replaceable>:\
	:lang=<replaceable>locale_name</replaceable>:\
	:tc=default:</programlisting>

	<para>So, the previous Latin-1 example would look like
	  this:</para>

	<programlisting>german|German Users Accounts:\
	:charset=ISO-8859-1:\
	:lang=de_DE.ISO8859-1:\
	:tc=default:</programlisting>

	<para>See &man.login.conf.5; for more details about these
	  variables.</para>

	<para>Whenever <filename>/etc/login.conf</filename> is edited,
	  remember to execute the following command to update the
	  capability database:</para>

	<screen>&prompt.root; <userinput>cap_mkdb /etc/login.conf</userinput></screen>

	<sect4>
	  <title>Utilities Which Change Login Classes</title>

	  <indexterm>
	    <primary><command>vipw</command></primary>
	  </indexterm>

	  <para>In addition to manually editing
	    <filename>/etc/login.conf</filename>, several utilities
	    are available for setting the locale for newly created
	    users.</para>

	  <para>When using <command>vipw</command> to add new users,
	    specify the <replaceable>language</replaceable> to set the
	    locale:</para>

	  <programlisting>user:password:1111:11:<replaceable>language</replaceable>:0:0:User Name:/home/user:/bin/sh</programlisting>

	  <indexterm>
	    <primary><command>adduser</command></primary>
	  </indexterm>
	  <indexterm><primary>login class</primary></indexterm>

	  <para>When using <command>adduser</command> to add new
	    users, the default language can be pre-configured for all
	    new users or specified for an individual user.</para>

	  <para>If all new users use the same language, set
	    <literal>defaultclass = language</literal> in
	    <filename>/etc/adduser.conf</filename>.</para>

	  <para>To override this setting when creating a user, either
	    input the required locale at this prompt:</para>

	  <screen><prompt>Enter login class: default []:</prompt></screen>

	  <para>or specify the locale to set when invoking
	    <command>adduser</command>:</para>

	  <screen>&prompt.root; <userinput>adduser -class language</userinput></screen>

	  <indexterm>
	    <primary><command>pw</command></primary>
	  </indexterm>

	  <para>If <command>pw</command> is used to add new users,
	    specify the locale as follows:</para>

	  <screen>&prompt.root; <userinput>pw useradd user_name -L language</userinput></screen>
	  </sect4>
	</sect3>

	<sect3 xml:id="startup-file">
	  <title>Shell Startup File Method</title>

	  <para>This method is not recommended as each shell that is
	    used requires manual configuration, where each shell has a
	    different configuration file and differing syntax.  As an
	    example, to set the German language for the
	    <command>sh</command> shell, these lines could be added to
	    <filename>~/.profile</filename> to set the shell for that
	    user only.  These lines could also be added to
	    <filename>/etc/profile</filename> or
	    <filename>/usr/share/skel/dot.profile</filename> to set
	    that shell for all users:</para>

	  <programlisting><envar>LANG=de_DE.ISO8859-1; export LANG</envar>
<envar>MM_CHARSET=ISO-8859-1; export MM_CHARSET</envar></programlisting>

	  <para>However, the name of the configuration file and the
	    syntax used differs for the <command>csh</command> shell.
	    These are the equivalent settings for
	    <filename>~/.csh.login</filename>,
	    <filename>/etc/csh.login</filename>, or
	    <filename>/usr/share/skel/dot.login</filename>:</para>

	  <programlisting><envar>setenv LANG de_DE.ISO8859-1</envar>
<envar>setenv MM_CHARSET ISO-8859-1</envar></programlisting>

	  <para>To complicate matters, the syntax needed to configure
	    <application>Xorg</application> in
	    <filename>~/.xinitrc</filename> also depends upon the
	    shell.  The first example is for the <command>sh</command>
	    shell and the second is for the <command>csh</command>
	    shell:</para>

	  <programlisting><envar>LANG=de_DE.ISO8859-1; export LANG</envar></programlisting>

	  <programlisting><envar>setenv LANG de_DE.ISO8859-1</envar></programlisting>
      </sect3>
    </sect2>

    <sect2 xml:id="setting-console">
      <title>Console Setup</title>

      <para>Several localized fonts are available for the console.  To
	see a listing of available fonts, type
	<command>ls /usr/share/syscons/fonts</command>.  To configure
	the console font, specify the
	<replaceable>font_name</replaceable>,
	without the <filename>.fnt</filename> suffix, in
	<filename>/etc/rc.conf</filename>:</para>

      <programlisting>font8x16=<replaceable>font_name</replaceable>
font8x14=<replaceable>font_name</replaceable>
font8x8=<replaceable>font_name</replaceable></programlisting>

      <indexterm><primary>keymap</primary></indexterm>
      <indexterm><primary>screenmap</primary></indexterm>
      <para>The keymap and screenmap  can be set by adding the
	following to <filename>/etc/rc.conf</filename>:</para>

      <programlisting>scrnmap=<replaceable>screenmap_name</replaceable>
keymap=<replaceable>keymap_name</replaceable>
keychange="<replaceable>fkey_number sequence</replaceable>"</programlisting>

      <para>To see the list of available screenmaps, type
	<command>ls /usr/share/syscons/scrnmaps</command>.  Do not
	include the <filename>.scm</filename> suffix when specifying
	<replaceable>screenmap_name</replaceable>.  A screenmap with a
	corresponding mapped font is usually needed as a workaround
	for expanding bit 8 to bit 9 on a VGA adapter's font character
	matrix so that letters are moved out of the pseudographics
	area if the screen font uses a bit 8 column.</para>

      <para>To see the list of available keymaps, type
	<filename>ls /usr/share/syscons/keymaps</filename>.  When
	specifying the <replaceable>keymap_name</replaceable>, do not
	include the <filename>.kbd</filename> suffix.  When uncertain
	as to which keymap to use, &man.kbdmap.1; can be used to test
	keymaps without rebooting.</para>

      <para>The <literal>keychange</literal> entry is usually needed
	to program function keys to match the selected terminal type
	because function key sequences cannot be defined in the
	keymap.</para>

      <para>Next, set the correct console terminal type in
	<filename>/etc/ttys</filename> for all virtual terminal
	entries.  <xref linkend="locale-charset"/> summarizes the
	available terminal types.:</para>

      <table xml:id="locale-charset" frame="none" pgwide="1">
	<title>Defined Terminal Types for Character Sets</title>

	<tgroup cols="2">
	  <thead>
	    <row>
	      <entry>Character Set</entry>
	      <entry>Terminal Type</entry>
	    </row>
	  </thead>

	  <tbody>
	    <row>
	      <entry>ISO8859-1 or ISO8859-15</entry>
	      <entry><literal>cons25l1</literal></entry>
	    </row>

	    <row>
	      <entry>ISO8859-2</entry>
	      <entry><literal>cons25l2</literal></entry>
	    </row>

	    <row>
	      <entry>ISO8859-7</entry>
	      <entry><literal>cons25l7</literal></entry>
	    </row>

	    <row>
	      <entry>KOI8-R</entry>
	      <entry><literal>cons25r</literal></entry>
	    </row>

	    <row>
	      <entry>KOI8-U</entry>
	      <entry><literal>cons25u</literal></entry>
	    </row>

	    <row>
	      <entry>CP437 (VGA default)</entry>
	      <entry><literal>cons25</literal></entry>
	    </row>

	    <row>
	      <entry>US-ASCII</entry>
	      <entry><literal>cons25w</literal></entry>
	    </row>
	  </tbody>
	</tgroup>
      </table>

      <indexterm>
	<primary><application>moused</application></primary>
      </indexterm>

      <para>For languages with wide or multibyte characters, install a
	console for that language from the &os; Ports Collection.  The
	available ports are summarized in <xref
	  linkend="locale-console"/>.  Once installed, refer to the
	port's <filename>pkg-message</filename> or man pages for
	configuration and usage instructions.</para>

      <table xml:id="locale-console" frame="none" pgwide="1">
	<title>Available Console From Ports Collection</title>

	<tgroup cols="2">
	  <thead>
	    <row>
	      <entry>Language</entry>
	      <entry>Port Location</entry>
	    </row>
	  </thead>

	  <tbody>
	    <row>
	      <entry>Traditional Chinese (BIG-5)</entry>
	      <entry><package>chinese/big5con</package></entry>
	    </row>

	    <row>
	      <entry>Chinese/Japanese/Korean</entry>
	      <entry><package>chinese/cce</package></entry>
	    </row>

	    <row>
	      <entry>Japanese</entry>
	      <entry><package>chinese/kon2</package></entry>
	    </row>

	    <row>
	      <entry>Chinese/Japanese/Korean</entry>
	      <entry><package>chinese/zhcon</package></entry>
	    </row>

	    <row>
	      <entry>Japanese</entry>
	      <entry><package>japanese/kon2-14dot</package></entry>
	    </row>

	    <row>
	      <entry>Japanese</entry>
	      <entry><package>japanese/kon2-16dot</package></entry>
	    </row>
	  </tbody>
	</tgroup>
      </table>

      <para>If <application>moused</application> is enabled in
	<filename>/etc/rc.conf</filename>, additional configuration
	may be required.  By default, the mouse cursor of the
	&man.syscons.4; driver occupies the
	<literal>0xd0</literal>-<literal>0xd3</literal> range in the
	character set.  If the language uses this range, move the
	cursor's range.  To enable this workaround for &os;, add the
	following line to <filename>/etc/rc.conf</filename>:</para>

      <programlisting>mousechar_start=3</programlisting>
    </sect2>

    <sect2>
      <title>Xorg Setup</title>

      <para><xref linkend="x11"/> describes how to install and
	configure <application>Xorg</application>.  When configuring
	<application>Xorg</application> for localization, additional
	fonts and input methods are available from the &os; Ports
	Collection.  Application specific <acronym>i18n</acronym>
	settings such as fonts and menus can be tuned in
	<filename>~/.Xresources</filename> and should allow users to
	view their selected language in graphical application
	menus.</para>

      <indexterm><primary>X Input Method (XIM)</primary></indexterm>

      <para>The X Input Method (<acronym>XIM</acronym>) protocol is an
	<application>Xorg</application> standard for  inputting
	non-English characters.  <xref linkend="locale-xim"/>
	summarizes the input method applications which are available
	in the &os; Ports Collection.  Additional Fcitx and Uim
	applications are also available.</para>

      <table xml:id="locale-xim" frame="none" pgwide="1">
	<title>Available Input Methods</title>

	<tgroup cols="2">
	  <thead>
	    <row>
	      <entry>Language</entry>
	      <entry>Input Method</entry>
	    </row>
	  </thead>

	  <tbody>

	    <row>
	      <entry>Chinese</entry>
	      <entry><package>chinese/gcin</package></entry>
	    </row>

	    <row>
	      <entry>Chinese</entry>
	      <entry><package>chinese/ibus-chewing</package></entry>
	    </row>

	    <row>
	      <entry>Chinese</entry>
	      <entry><package>chinese/ibus-pinyin</package></entry>
	    </row>

	    <row>
	      <entry>Chinese</entry>
	      <entry><package>chinese/oxim</package></entry>
	    </row>

	    <row>
	      <entry>Chinese</entry>
	      <entry><package>chinese/scim-fcitx</package></entry>
	    </row>

	    <row>
	      <entry>Chinese</entry>
	      <entry><package>chinese/scim-pinyin</package></entry>
	    </row>

	    <row>
	      <entry>Chinese</entry>
	      <entry><package>chinese/scim-tables</package></entry>
	    </row>

	    <row>
	      <entry>Japanese</entry>
	      <entry><package>japanese/ibus-anthy</package></entry>
	    </row>

	    <row>
	      <entry>Japanese</entry>
	      <entry><package>japanese/ibus-mozc</package></entry>
	    </row>

	    <row>
	      <entry>Japanese</entry>
	      <entry><package>japanese/ibus-skk</package></entry>
	    </row>

	    <row>
	      <entry>Japanese</entry>
	      <entry><package>japanese/im-ja</package></entry>
	    </row>

	    <row>
	      <entry>Japanese</entry>
	      <entry><package>japanese/kinput2</package></entry>
	    </row>

	    <row>
	      <entry>Japanese</entry>
	      <entry><package>japanese/scim-anthy</package></entry>
	    </row>

	    <row>
	      <entry>Japanese</entry>
	      <entry><package>japanese/scim-canna</package></entry>
	    </row>

	    <row>
	      <entry>Japanese</entry>
	      <entry><package>japanese/scim-honoka</package></entry>
	    </row>

	    <row>
	      <entry>Japanese</entry>
	      <entry><package>japanese/scim-honoka-plugin-romkan</package></entry>
	    </row>

	    <row>
	      <entry>Japanese</entry>
	      <entry><package>japanese/scim-honoka-plugin-wnn</package></entry>
	    </row>

	    <row>
	      <entry>Japanese</entry>
	      <entry><package>japanese/scim-prime</package></entry>
	    </row>

	    <row>
	      <entry>Japanese</entry>
	      <entry><package>japanese/scim-skk</package></entry>
	    </row>

	    <row>
	      <entry>Japanese</entry>
	      <entry><package>japanese/scim-tables</package></entry>
	    </row>

	    <row>
	      <entry>Japanese</entry>
	      <entry><package>japanese/scim-tomoe</package></entry>
	    </row>

	    <row>
	      <entry>Japanese</entry>
	      <entry><package>japanese/scim-uim</package></entry>
	    </row>

	    <row>
	      <entry>Japanese</entry>
	      <entry><package>japanese/skkinput</package></entry>
	    </row>

	    <row>
	      <entry>Japanese</entry>
	      <entry><package>japanese/skkinput3</package></entry>
	    </row>

	    <row>
	      <entry>Japanese</entry>
	      <entry><package>japanese/uim-anthy</package></entry>
	    </row>

	    <row>
	      <entry>Korean</entry>
	      <entry><package>korean/ibus-hangul</package></entry>
	    </row>

	    <row>
	      <entry>Korean</entry>
	      <entry><package>korean/imhangul</package></entry>
	    </row>

	    <row>
	      <entry>Korean</entry>
	      <entry><package>korean/nabi</package></entry>
	    </row>

	    <row>
	      <entry>Korean</entry>
	      <entry><package>korean/scim-hangul</package></entry>
	    </row>

	    <row>
	      <entry>Korean</entry>
	      <entry><package>korean/scim-tables</package></entry>
	    </row>

	    <row>
	      <entry>Vietnamese</entry>
	      <entry><package>vietnamese/xvnkb</package></entry>
	    </row>

	    <row>
	      <entry>Vietnamese</entry>
	      <entry><package>vietnamese/x-unikey</package></entry>
	    </row>
	  </tbody>
	</tgroup>
      </table>
    </sect2>
<!--
Comment out for now. If needed, can be added as note in new Printing chapter.
    <sect2>
      <title>Printer Setup</title>

      <para>Some single C chars character sets are hardware coded
	into printers.  Wide or multibyte character sets require
	special setup using a utility such as
	<application>apsfilter</application>.  Documents can be
	converted to &postscript; or PDF formats using language
	specific converters.</para>
    </sect2>
    -->
    <sect2>
      <title>Kernel and File Systems</title>

      <para>The &os; fast filesystem (<acronym>FFS</acronym>) is 8-bit
	clean, so it can be used with any single C chars character
	set.  However, character set names are not stored in the
	filesystem as it is raw 8-bit and does not understand encoding
	order.  Officially, <acronym>FFS</acronym> does not support
	any form of wide or multibyte character sets.  However, some
	wide or multibyte character sets have independent patches for
	enabling support on <acronym>FFS</acronym>.  Refer to the
	respective languages' web sites for more information and the
	patch files.</para>

      <indexterm><primary>DOS</primary></indexterm>
      <indexterm><primary>Unicode</primary></indexterm>
      <para>&os;'s support for the &ms-dos; filesystem has the
	configurable ability to convert between &ms-dos;, Unicode
	character sets, and chosen &os; filesystem character sets.
	Refer to &man.mount.msdosfs.8; for details.</para>
    </sect2>
  </sect1>

  <sect1 xml:id="l10n-compiling">
    <title>Compiling <acronym>i18n</acronym> Programs</title>

    <para>The &os; <link xlink:href="&url.base;/ports/index.html">&os;
	Ports Collection</link> contains programs which provide
      application support for wide or multibyte characters for several
      languages.  Refer to the <acronym>i18n</acronym> documentation
      in the respective &os; port for more information on how to
      configure the application correctly or to determine which
      compile options to use when building the port.</para>

    <para>Some things to keep in mind are:</para>

    <itemizedlist>
      <listitem>
	<para>Language specific single C chars character sets such as
	  ISO8859-1, ISO8859-15, KOI8-R, and CP437.  These are
	  described in &man.multibyte.3;.</para>
      </listitem>

      <listitem>
	<para>Wide or multibyte encodings such as EUC and Big5.</para>
      </listitem>
    </itemizedlist>

    <para>The active list of character sets can be found at the <link
	xlink:href="http://www.iana.org/assignments/character-sets">IANA
	Registry</link>.</para>

    <note>
      <para>&os; uses Xorg-compatible locale encodings instead.</para>
    </note>

    <para>In the &os; Ports Collection, <acronym>i18n</acronym>
      applications include <literal>i18n</literal> in their names for
      easy identification.  However, they do not always support the
      language needed.</para>

    <para>Many applications in the &os; Ports Collection have been
      ported with <acronym>i18n</acronym> support.  Some of these
      include <literal>-i18n</literal> in the port name.  These
      and many other programs have built in support for
      <acronym>i18n</acronym> and need no special
      consideration.</para>

    <indexterm>
      <primary><application>MySQL</application></primary>
    </indexterm>
    <para>However, some applications such as
      <application>MySQL</application> need to have their
      <filename>Makefile</filename> configured with the specific
      charset.  This is usually done in the port's
      <filename>Makefile</filename> or by passing a value to
      <application>configure</application> in the source.</para>
  </sect1>

  <sect1 xml:id="lang-setup">
    <title>Locale Configuration for Specific Languages</title>

    <para>This section provides configuration examples for localizing
      a &os; system for the Russian language.  It then provides some
      additional resources for localizing other languages.</para>

    <sect2 xml:id="ru-localize">
      <info>
	<title>Russian Language (KOI8-R Encoding)</title>

	<authorgroup>
	  <author><personname><firstname>Andrey</firstname><surname>Chernov</surname></personname><contrib>Originally
	    contributed by </contrib></author>
	</authorgroup>
      </info>

      <indexterm>
	<primary>localization</primary>
	<secondary>Russian</secondary>
      </indexterm>

      <para>To set this locale for the login shell, add the following
	lines into each user's
	<filename>~/.login_conf</filename>:</para>

      <programlisting>me:My Account:\
	:charset=KOI8-R:\
	:lang=ru_RU.KOI8-R:</programlisting>

      <para>To configure the console, add the following lines to
	<filename>/etc/rc.conf</filename>:</para>

      <programlisting>keymap="ru.koi8-r"
scrnmap="koi8-r2cp866"
font8x16="cp866b-8x16"
font8x14="cp866-8x14"
font8x8="cp866-8x8"
mousechar_start=3</programlisting>

      <para>For each <literal>ttyv</literal> entry in
	<filename>/etc/ttys</filename>, use
	<literal>cons25r</literal> as the terminal type.</para>

      <indexterm><primary>printers</primary></indexterm>
      <para>To configure printing, a special output filter is needed
	to convert from KOI8-R to CP866 since most printers with
	Russian characters come with hardware code page CP866.  &os;
	includes a default filter for this purpose,
	<filename>/usr/libexec/lpr/ru/koi2alt</filename>.  To use this
	filter, add this entry to
	<filename>/etc/printcap</filename>:</para>

      <programlisting>lp|Russian local line printer:\
	:sh:of=/usr/libexec/lpr/ru/koi2alt:\
	:lp=/dev/lpt0:sd=/var/spool/output/lpd:lf=/var/log/lpd-errs:</programlisting>

      <para>Refer to &man.printcap.5; for a more detailed
	explanation.</para>

      <para>To configure support for Russian filenames in mounted
	&ms-dos; file systems, include <option>-L</option> and the
	locale name when adding an entry to
	<filename>/etc/fstab</filename>:</para>

     <programlisting>/dev/ad0s2      /dos/c  msdos   rw,-Lru_RU.KOI8-R 0 0</programlisting>

      <para>Refer to &man.mount.msdosfs.8; for more details.</para>

      <para>To configure Russian fonts for
	<application>&xorg;</application>, install the
	<package>x11-fonts/xorg-fonts-cyrillic</package> package.
	Then, check the <literal>"Files"</literal> section in
	<filename>/etc/X11/xorg.conf</filename>.  The following line
	must be added <emphasis>before</emphasis> any other
	<literal>FontPath</literal> entries:</para>

      <programlisting>FontPath   "/usr/local/lib/X11/fonts/cyrillic"</programlisting>

      <para>Additional Cyrillic fonts are available in the Ports
	Collection.</para>

      <para>To activate a Russian keyboard, add the following to the
	<literal>"Keyboard"</literal> section of
	<filename>/etc/xorg.conf</filename>:</para>

      <programlisting>Option "XkbLayout"   "us,ru"
Option "XkbOptions"  "grp:toggle"</programlisting>

      <para>Make sure that <literal>XkbDisable</literal> is
	commented out in that file.</para>

      <para>For <literal>grp:toggle</literal> use
	<keycap>Right Alt</keycap>, for
	<literal>grp:ctrl_shift_toggle</literal> use <keycombo
	  action="simul"><keycap>Ctrl</keycap><keycap>Shift</keycap></keycombo>.
	For <literal>grp:caps_toggle</literal> use
	<keycap>CapsLock</keycap>.  The old
	<keycap>CapsLock</keycap> function is still available in LAT
	mode only using <keycombo
	  action="simul"><keycap>Shift</keycap><keycap>CapsLock</keycap></keycombo>.
	<literal>grp:caps_toggle</literal> does not work in
	<application>&xorg;</application> for some unknown
	reason.</para>

      <para>If the keyboard has <quote>&windows;</quote> keys, and
	some non-alphabetical keys are mapped incorrectly, add the
	following line to <filename>/etc/xorg.conf</filename>:</para>

      <programlisting>Option "XkbVariant" ",winkeys"</programlisting>

      <note>
	<para>The Russian XKB keyboard may not work with
	  non-localized applications.</para>
      </note>

      <para>Minimally localized applications should call a
	<function>XtSetLanguageProc (NULL, NULL, NULL);</function>
	function early in the program.</para>

      <para>See <link xlink:href="http://koi8.pp.ru/xwin.html">
	  KOI8-R for X Window</link> for more instructions on
	localizing <application>Xorg</application> applications.  For
	more general information about KOI8-R encoding, refer to
	<link xlink:href="http://koi8.pp.ru/">KOI8-R -
	  Russian Net Character Set</link>.</para>
    </sect2>

    <sect2>
      <title>Additional Language-Specific Resources</title>

      <para>Some intro text here...</para>

      <indexterm>
	<primary>localization</primary>
	<secondary>Traditional Chinese</secondary>
      </indexterm>
      <indexterm>
	<primary>localization</primary>
	<secondary>German</secondary>
      </indexterm>
      <indexterm>
	<primary>localization</primary>
	<secondary>Greek</secondary>
      </indexterm>
      <indexterm>
	<primary>localization</primary>
	<secondary>Japanese</secondary>
      </indexterm>
      <indexterm>
	<primary>localization</primary>
	<secondary>Korean</secondary>
      </indexterm>

      <variablelist>
	<varlistentry>
	  <term>Traditional Chinese for Taiwan</term>

	  <listitem>
	    <para>The &os;-Taiwan Project has a Chinese HOWTO for &os;
	      at <uri
		xlink:href="http://netlab.cse.yzu.edu.tw/~statue/freebsd/zh-tut/">http://netlab.cse.yzu.edu.tw/~statue/freebsd/zh-tut/</uri>
	      using many Chinese ports.  The current editor for the
	      <literal>&os; Chinese HOWTO</literal> is Shen
	      Chuan-Hsing
	      <email>statue@freebsd.sinica.edu.tw</email>.</para>
	  </listitem>
	</varlistentry>

	<varlistentry>
	  <term>German Language Localization for All ISO 8859-1
	    Languages</term>

	  <listitem>
	    <para>Slaven <email>eserte@cs.tu-berlin.de</email> wrote a
	      tutorial on using umlauts on &os;.  The tutorial is
	      written in German and is available at <uri
		xlink:href="http://user.cs.tu-berlin.de/~eserte/FreeBSD/doc/umlaute/umlaute.html">http://user.cs.tu-berlin.de/~eserte/FreeBSD/doc/umlaute/umlaute.html</uri>.</para>
	  </listitem>
	</varlistentry>

	<varlistentry>
	  <term>Greek Language Localization</term>

	  <listitem>
	    <para>Nikos Kokkalis <email>nickkokkalis@gmail.com</email>
	      has written a complete article on Greek support in &os;.
	      It is available <link
		xlink:href="&url.doc.base;/el_GR.ISO8859-7/articles/greek-language-support/index.html">here</link>,
	      in Greek only, as part of the official &os; Greek
	      documentation.</para>
	  </listitem>
	</varlistentry>

	<varlistentry>
	  <term>Japanese and Korean Language Localization</term>

	  <listitem>
	    <para>For Japanese, refer to <uri
		xlink:href="http://www.jp.FreeBSD.org/">http://www.jp.FreeBSD.org/</uri>,
	      and for Korean, refer to <uri
		xlink:href="http://www.kr.FreeBSD.org/">http://www.kr.FreeBSD.org/</uri>.</para>
	  </listitem>
	</varlistentry>

	<varlistentry>
	  <term>Non-English &os; Documentation</term>

	  <listitem>
	    <para>Some &os; contributors have translated parts of the
	      &os; documentation to other languages.  They are
	      available through links on the <link
		xlink:href="&url.base;/index.html">main site</link> or
	      in <filename>/usr/share/doc</filename>.</para>
	  </listitem>
	</varlistentry>
      </variablelist>
    </sect2>
  </sect1>
</chapter>