More tightening and clarification in this chapter. More commits to follow.

Sponsored by: iXsystems
This commit is contained in:
Dru Lavigne 2014-02-11 16:35:54 +00:00
parent e7a009cbeb
commit 14f6f9faeb
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=43873

View file

@ -173,64 +173,60 @@
<sect2 xml:id="setting-locale"> <sect2 xml:id="setting-locale">
<title>Setting Locale for Login Shell</title> <title>Setting Locale for Login Shell</title>
<para>Usually it is sufficient to export the value of the <para>Locale settings are configured either in a user's
locale name as <envar>LANG</envar> in the login shell. This <filename>~/.login_conf</filename>
could be done in the user's <filename>~/.login_conf</filename>
or in the startup file of the user's shell: or in the startup file of the user's shell:
(<filename>~/.profile</filename>, <filename>~/.profile</filename>,
<filename>~/.bashrc</filename>, or <filename>~/.bashrc</filename>, or
<filename>~/.cshrc</filename>). There is no need to set the <filename>~/.cshrc</filename>.</para>
locale subsets such as <envar>LC_CTYPE</envar> or
<envar>LC_CTIME</envar>. Refer to language-specific &os;
documentation for more information.</para>
<para>Each user should set the following two environment <para>Two environment
variables in their configuration files:</para> variables should be set:</para>
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para><envar>LANG</envar> for &posix;<indexterm> <para><envar>LANG</envar>, which sets the locale<indexterm>
<primary>POSIX</primary> <primary>POSIX</primary>
</indexterm> </indexterm></para>
&man.setlocale.3; family functions</para>
</listitem> </listitem>
<listitem> <listitem>
<indexterm><primary>MIME</primary></indexterm> <indexterm><primary>MIME</primary></indexterm>
<para><envar>MM_CHARSET</envar> for applications' MIME <para><envar>MM_CHARSET</envar> which sets the MIME
character set</para> character set used by applications</para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
<para>These should be set in the user's shell configuration, the <para>In addition to the user's shell configuration, these
specific application configuration, and the variables should also be set for
specific application configuration and
<application>Xorg</application> configuration.</para> <application>Xorg</application> configuration.</para>
<indexterm><primary>locale</primary></indexterm> <indexterm><primary>locale</primary></indexterm>
<indexterm><primary>login class</primary></indexterm> <indexterm><primary>login class</primary></indexterm>
<para>This section describes the two methods for setting <para>Two methods are available for making the needed variable
locale. The first is recommended and assigns the assignments: the
environment variables in the <link linkend="login-class">login class</link> method, which
<link linkend="login-class">login class</link>. The second is the recommended method, and the
method adds the environment variable assignments to the <link linkend="startup-file">startup file</link> method.
system's shell The next two sections demonstrate how to use both methods.</para>
<link linkend="startup-file">startup file</link>.</para>
<sect3 xml:id="login-class"> <sect3 xml:id="login-class">
<title>Login Classes Method</title> <title>Login Classes Method</title>
<para>This method assigns the required environment variables for <para>This first method is the recommended method as it
assigns the required environment variables for
locale name and MIME character sets locale name and MIME character sets
for every possible shell. for every possible shell.
This setup can be either be This setup can either be
performed by each user or it can be performed for all users by the performed by each user or it can be configured for all users by the
superuser.</para> superuser.</para>
<para>This minimal example sets both variables for the <para>This minimal example sets both variables for
Latin-1 encoding. These lines were added to the Latin-1 encoding in the
<filename>.login_conf</filename> in an individual user's <filename>.login_conf</filename> of an individual user's
home directory:</para> home directory:</para>
<programlisting>me:\ <programlisting>me:\
@ -240,9 +236,9 @@
<indexterm><primary>Traditional Chinese</primary> <indexterm><primary>Traditional Chinese</primary>
<secondary>BIG-5 encoding</secondary></indexterm> <secondary>BIG-5 encoding</secondary></indexterm>
<para>Here is an example of a user's <para>Here is an example of a user's
<filename>.login_conf</filename> that sets the variables <filename>~/.login_conf</filename> that sets the variables
for Traditional Chinese in BIG-5 encoding. More for Traditional Chinese in BIG-5 encoding. More
variables are set because some applications do not variables are needed because some applications do not
correctly respect locale variables for Chinese, correctly respect locale variables for Chinese,
Japanese, and Korean:</para> Japanese, and Korean:</para>
@ -260,19 +256,16 @@ me:\
:charset=big5:\ :charset=big5:\
:xmodifiers="@im=gcin": #Set gcin as the XIM Input Server</programlisting> :xmodifiers="@im=gcin": #Set gcin as the XIM Input Server</programlisting>
<para>See &man.login.conf.5; for more <para>Alternately, the superuser can configure all users of the system for localization. The following variables in
details.</para> <filename>/etc/login.conf</filename> are used to set the locale and
MIME character sete:</para>
<para>Alternately, the superuser can configure all users of the system for localization. The following variables in the user's login class in
<filename>/etc/login.conf</filename> set the correct
language:</para>
<programlisting><replaceable>language_name</replaceable>|<replaceable>Account Type Description</replaceable>:\ <programlisting><replaceable>language_name</replaceable>|<replaceable>Account Type Description</replaceable>:\
:charset=<replaceable>MIME_charset</replaceable>:\ :charset=<replaceable>MIME_charset</replaceable>:\
:lang=<replaceable>locale_name</replaceable>:\ :lang=<replaceable>locale_name</replaceable>:\
:tc=default:</programlisting> :tc=default:</programlisting>
<para>The previous Latin-1 example would look like <para>So, the previous Latin-1 example would look like
this:</para> this:</para>
<programlisting>german|German Users Accounts:\ <programlisting>german|German Users Accounts:\
@ -280,73 +273,61 @@ me:\
:lang=de_DE.ISO8859-1:\ :lang=de_DE.ISO8859-1:\
:tc=default:</programlisting> :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 <para>Whenever <filename>/etc/login.conf</filename> is edited, remember to execute the following
command to update the capability database:</para> command to update the capability database:</para>
<screen>&prompt.root; <userinput>cap_mkdb /etc/login.conf</userinput></screen> <screen>&prompt.root; <userinput>cap_mkdb /etc/login.conf</userinput></screen>
<sect4> <sect4>
<title>Changing Login Classes with <title>Utilities Which Change Login Classes</title>
&man.vipw.8;</title>
<indexterm> <indexterm>
<primary><command>vipw</command></primary> <primary><command>vipw</command></primary>
</indexterm> </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, <para>When using <command>vipw</command> to add new users,
use <replaceable>language</replaceable> to set the specify the <replaceable>language</replaceable> to set the
language:</para> locale:</para>
<programlisting>user:password:1111:11:<replaceable>language</replaceable>:0:0:User Name:/home/user:/bin/sh</programlisting> <programlisting>user:password:1111:11:<replaceable>language</replaceable>:0:0:User Name:/home/user:/bin/sh</programlisting>
</sect4>
<sect4>
<title>Changing Login Classes with
&man.adduser.8;</title>
<indexterm> <indexterm>
<primary><command>adduser</command></primary> <primary><command>adduser</command></primary>
</indexterm> </indexterm>
<indexterm><primary>login class</primary></indexterm> <indexterm><primary>login class</primary></indexterm>
<para>When using <command>adduser</command> to add new <para>When using <command>adduser</command> to add new
users, configure the language as follows:</para> users, the default language can be pre-configured for
all new users or specified for an individual user.</para>
<itemizedlist>
<listitem>
<para>If all new users use the same language, set <para>If all new users use the same language, set
<literal>defaultclass = <literal>defaultclass =
language</literal> in language</literal> in
<filename>/etc/adduser.conf</filename>.</para> <filename>/etc/adduser.conf</filename>.</para>
</listitem>
<listitem> <para>To override this setting when creating a
<para>Alternatively, input the specified language at user, either input the required locale at
this prompt: this prompt:</para>
<screen><prompt>Enter login class: default []:</prompt></screen> <screen><prompt>Enter login class: default []:</prompt></screen>
when creating a new user using <para>or specify the locale to set when invoking
&man.adduser.8;.</para> <command>adduser</command>:</para>
</listitem>
<listitem>
<para>Another alternative is to use the following
when creating a user that uses a different language
than the one set in
<filename>/etc/adduser.conf</filename>:</para>
<screen>&prompt.root; <userinput>adduser -class language</userinput></screen> <screen>&prompt.root; <userinput>adduser -class language</userinput></screen>
</listitem>
</itemizedlist>
</sect4>
<sect4>
<title>Changing Login Classes with
&man.pw.8;</title>
<indexterm> <indexterm>
<primary><command>pw</command></primary> <primary><command>pw</command></primary>
</indexterm> </indexterm>
<para>If &man.pw.8; is used to add new users, call <para>If <command>pw</command> is used to add new users, specify the
it in this form:</para> locale as follows:</para>
<screen>&prompt.root; <userinput>pw useradd user_name -L language</userinput></screen> <screen>&prompt.root; <userinput>pw useradd user_name -L language</userinput></screen>
</sect4> </sect4>
@ -355,39 +336,33 @@ me:\
<sect3 xml:id="startup-file"> <sect3 xml:id="startup-file">
<title>Shell Startup File Method</title> <title>Shell Startup File Method</title>
<note> <para>This method is not recommended as each shell that is used requires
<para>This method is not recommended because it requires manual configuration, where each shell has a different configuration file
a different setup for each shell. Use the <link and differing syntax. As an example, to set the German
linkend="login-class">Login Class Method</link> language for the <command>sh</command> shell, these
instead.</para> lines could be added to <filename>~/.profile</filename> to set the shell for that user only.
</note> Thse 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>
<indexterm><primary>MIME</primary></indexterm>
<indexterm><primary>locale</primary></indexterm>
<para>To add the locale name and MIME character set, set
the two environment variables shown below in the
<filename>/etc/profile</filename> or
<filename>/etc/csh.login</filename> shell startup files.
This example sets the German language:</para>
<para>In <filename>/etc/profile</filename>:</para>
<programlisting><envar>LANG=de_DE.ISO8859-1; export LANG</envar> <programlisting><envar>LANG=de_DE.ISO8859-1; export LANG</envar>
<envar>MM_CHARSET=ISO-8859-1; export MM_CHARSET</envar></programlisting> <envar>MM_CHARSET=ISO-8859-1; export MM_CHARSET</envar></programlisting>
<para>Or in <filename>/etc/csh.login</filename>:</para> <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> <programlisting><envar>setenv LANG de_DE.ISO8859-1</envar>
<envar>setenv MM_CHARSET ISO-8859-1</envar></programlisting> <envar>setenv MM_CHARSET ISO-8859-1</envar></programlisting>
<para>Alternatively, add the above settings to <para>To complicate matters, the syntax needed to configure
<filename>/usr/share/skel/dot.profile</filename> or <application>Xorg</application> in
<filename>/usr/share/skel/dot.login</filename>.</para> <filename>~/.xinitrc</filename> also depends upon the
shell. The first example is for the <command>sh</command>
<para>To configure <application>Xorg</application>, add shell and the second is for the <command>csh</command>
<emphasis>one</emphasis> of the following to shell.</para>
<filename>~/.xinitrc</filename>, depending upon the
shell:</para>
<programlisting><envar>LANG=de_DE.ISO8859-1; export LANG</envar></programlisting> <programlisting><envar>LANG=de_DE.ISO8859-1; export LANG</envar></programlisting>