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">
<title>Setting Locale for Login Shell</title>
<para>Usually it is sufficient to export the value of the
locale name as <envar>LANG</envar> in the login shell. This
could be done in the user's <filename>~/.login_conf</filename>
<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>~/.profile</filename>,
<filename>~/.bashrc</filename>, or
<filename>~/.cshrc</filename>). There is no need to set the
locale subsets such as <envar>LC_CTYPE</envar> or
<envar>LC_CTIME</envar>. Refer to language-specific &os;
documentation for more information.</para>
<filename>~/.cshrc</filename>.</para>
<para>Each user should set the following two environment
variables in their configuration files:</para>
<para>Two environment
variables should be set:</para>
<itemizedlist>
<listitem>
<para><envar>LANG</envar> for &posix;<indexterm>
<para><envar>LANG</envar>, which sets the locale<indexterm>
<primary>POSIX</primary>
</indexterm>
&man.setlocale.3; family functions</para>
</indexterm></para>
</listitem>
<listitem>
<indexterm><primary>MIME</primary></indexterm>
<para><envar>MM_CHARSET</envar> for applications' MIME
character set</para>
<para><envar>MM_CHARSET</envar> which sets the MIME
character set used by applications</para>
</listitem>
</itemizedlist>
<para>These should be set in the user's shell configuration, the
specific application configuration, and the
<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>This section describes the two methods for setting
locale. The first is recommended and assigns the
environment variables in the
<link linkend="login-class">login class</link>. The second
method adds the environment variable assignments to the
system's shell
<link linkend="startup-file">startup file</link>.</para>
<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 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
for every possible shell.
This setup can be either be
performed by each user or it can be performed for all users by the
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 the
Latin-1 encoding. These lines were added to the
<filename>.login_conf</filename> in an individual user's
<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:\
@ -240,9 +236,9 @@
<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
<filename>~/.login_conf</filename> that sets the variables
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,
Japanese, and Korean:</para>
@ -260,19 +256,16 @@ me:\
:charset=big5:\
:xmodifiers="@im=gcin": #Set gcin as the XIM Input Server</programlisting>
<para>See &man.login.conf.5; for more
details.</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>
<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>The previous Latin-1 example would look like
<para>So, the previous Latin-1 example would look like
this:</para>
<programlisting>german|German Users Accounts:\
@ -280,73 +273,61 @@ me:\
: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>Changing Login Classes with
&man.vipw.8;</title>
<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,
use <replaceable>language</replaceable> to set the
language:</para>
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>
</sect4>
<sect4>
<title>Changing Login Classes with
&man.adduser.8;</title>
<indexterm>
<primary><command>adduser</command></primary>
</indexterm>
<indexterm><primary>login class</primary></indexterm>
<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
<literal>defaultclass =
language</literal> in
<filename>/etc/adduser.conf</filename>.</para>
</listitem>
<listitem>
<para>Alternatively, input the specified language at
this prompt:
<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>
when creating a new user using
&man.adduser.8;.</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>
<para>or specify the locale to set when invoking
<command>adduser</command>:</para>
<screen>&prompt.root; <userinput>adduser -class language</userinput></screen>
</listitem>
</itemizedlist>
</sect4>
<sect4>
<title>Changing Login Classes with
&man.pw.8;</title>
<indexterm>
<primary><command>pw</command></primary>
</indexterm>
<para>If &man.pw.8; is used to add new users, call
it in this form:</para>
<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>
@ -355,39 +336,33 @@ me:\
<sect3 xml:id="startup-file">
<title>Shell Startup File Method</title>
<note>
<para>This method is not recommended because it requires
a different setup for each shell. Use the <link
linkend="login-class">Login Class Method</link>
instead.</para>
</note>
<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>
<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.
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>
<programlisting><envar>LANG=de_DE.ISO8859-1; export LANG</envar>
<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>
<envar>setenv MM_CHARSET ISO-8859-1</envar></programlisting>
<para>Alternatively, add the above settings to
<filename>/usr/share/skel/dot.profile</filename> or
<filename>/usr/share/skel/dot.login</filename>.</para>
<para>To configure <application>Xorg</application>, add
<emphasis>one</emphasis> of the following to
<filename>~/.xinitrc</filename>, depending upon the
shell:</para>
<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>