22.4 Language and Country-Specific Settings
SUSE® Linux Enterprise is, to a very large extent, internationalized and can be modified
for local needs in a flexible manner. In other words, internationalization
(I18N) allows specific localizations
(L10N). The abbreviations I18N and L10N are derived
from the first and last letters of the words and, in between, the number of
letters omitted.
Settings are made with LC_ variables defined in
the file /etc/sysconfig/language.
This refers not only to native language support, but
also to the categories Messages (Language),
Character Set, Sort Order,
Time and Date, Numbers, and
Money. Each of these categories can be defined directly
with its own variable or indirectly with a master variable in the file
language (see the locale man page).
- RC_LC_MESSAGES,
RC_LC_CTYPE,
RC_LC_COLLATE,
RC_LC_TIME,
RC_LC_NUMERIC,
RC_LC_MONETARY
-
These variables are passed to the shell without the
RC_ prefix and represent the listed
categories. The shell profiles concerned are listed below. The current
setting can be shown with the command locale.
- RC_LC_ALL
-
This variable, if set, overwrites the values of the variables already
mentioned.
- RC_LANG
-
If none of the previous variables are set, this is the fallback. By default,
SUSE Linux only sets RC_LANG. This makes it
easier for users to enter their own values.
- ROOT_USES_LANG
-
A yes or no variable. If it is set
to no, root
always works in the POSIX environment.
The variables can be set with the YaST sysconfig editor (see Section 20.3.1,
Changing the System Configuration Using the YaST sysconfig
Editor). The value of such a variable contains
the language code, country code, encoding, and modifier. The individual
components are connected by special characters:
LANG=<language>[[_<COUNTRY>].<Encoding>[@<Modifier>]]
22.4.1 Some Examples
You should always set the language and country codes together. Language
settings follow the standard ISO 639 available at https://www.evertype.com/standards/iso639/iso639-en.html
and https://www.loc.gov/standards/iso639-2/. Country codes
are listed in ISO 3166 available at https://www.din.de/gremien/nas/nabd/iso3166ma/codlstp1/en_listp1.html.
It only makes sense to set values for which usable description files can be
found in /usr/lib/locale. Additional description files
can be created from the files in /usr/share/i18n using
the command localedef. The description files are part of
the glibc-i18ndata package. A description file for
en_US.UTF-8 (for English and United States) can be
created with:
localedef -i en_US -f UTF-8 en_US.UTF-8
-
LANG=en_US.UTF-8
-
This is the default setting if American English is selected during
installation. If
you selected another language, that language is enabled but
still with UTF-8 as the character encoding.
-
LANG=en_US.ISO-8859-1
-
This sets the language to English, country to United States, and
the character set to ISO-8859-1. This character set
does not support the Euro sign, but it can be useful sometimes for
programs that have not been updated to support UTF-8.
The string defining the charset (ISO-8859-1 in this
case) is then evaluated by programs like Emacs.
-
LANG=en_IE@euro
-
The above example explicitly includes the Euro sign in a language setting.
Strictly speaking, this setting is obsolete now, because UTF-8 also
covers the
Euro symbol. It is only useful if an application does not support UTF-8,
but ISO-8859-15.
SuSEconfig reads the variables in
/etc/sysconfig/language and writes the necessary
changes to /etc/SuSEconfig/profile and
/etc/SuSEconfig/csh.cshrc.
/etc/SuSEconfig/profile is read or
sourced by /etc/profile.
/etc/SuSEconfig/csh.cshrc is sourced by
/etc/csh.cshrc. This makes the settings available
systemwide.
Users can override the system defaults by editing their
~/.bashrc accordingly. For instance, if you do not want
to use the systemwide en_US for program messages,
include LC_MESSAGES=es_ES so messages are
displayed in Spanish instead.
22.4.2 Locale Settings in ~/.i18n
If you are not satisfied with locale system defaults, change the
settings in ~/.i18n. Entries in
~/.i18n override system defaults from
/etc/sysconfig/language. Use the same variable names
but without the RC_ namespace prefixes, for example, use
LANG instead of RC_LANG.
22.4.3 Settings for Language Support
Files in the category Messages are, as a rule, only
stored in the corresponding language directory (like
en) to have a fallback. If you set LANG to en_US and the
message file in
/usr/share/locale/en_US/LC_MESSAGES does not exist, it
falls back to /usr/share/locale/en/LC_MESSAGES.
A fallback chain can also be defined, for example, for Breton to French or
for Galician to Spanish to Portuguese:
LANGUAGE="br_FR:fr_FR"
LANGUAGE="gl_ES:es_ES:pt_PT"
If desired, use the Norwegian variants Nynorsk
and Bokmål instead (with additional fallback to
no):
LANG="nn_NO"
LANGUAGE="nn_NO:nb_NO:no"
or
LANG="nb_NO"
LANGUAGE="nb_NO:nn_NO:no"
Note that in Norwegian, LC_TIME
is also treated differently.
One problem that can arise is a separator used to delimit groups of digits
not being recognized properly. This occurs if LANG
is set to only a two-letter language code like de, but
the definition file glibc uses is located in
/usr/share/lib/de_DE/LC_NUMERIC. Thus
LC_NUMERIC must be set to de_DE
to make the separator definition visible to the system.
22.4.4 For More Information
-
The GNU C Library Reference Manual,
Chapter Locales and Internationalization
. It is included in
glibc-info.
-
Markus Kuhn, UTF-8 and Unicode FAQ for Unix/Linux,
currently at https://www.cl.cam.ac.uk/~mgk25/unicode.html.
-
Unicode-Howto, by Bruno Haible: /usr/share/doc/howto/en/html/Unicode-HOWTO.html.