Users can change their locale settings with shell environment variables. Each category names an existing locale. The setlocale() function directly sets or queries the setting of these categories. Internationalized functions use these settings to access the appropriate tables for the desired locale.
Environment variables can indirectly set the categories: when setlocale() sets the categories to the default setting for that site, it uses the setting of each environment variable to set the associated categories. The setlocale() function does not change the settings of environment variables, it only reads their settings.
You can change the default locale system-wide with the following procedure.
Edit the /etc/default/init file by adding or changing the line.
Substitute C, zh, zh.GBK, zh_CN.GB18030 or zh.UTF-8 for locale.
LANG=locale |
Have all users exit CDE.
Type the following commands:
% su # /usr/dt/bin/dtconfig -kill |
Type the following commands:
% su # reboot |
The terms locale and category relate to each other as follows:
A locale includes specification of a language, territory, code set, and other features. The Simplified Chinese Solaris operating environment includes the following locales:
C
--For the
ASCII English environment, the locale must be set to C
.
zh
--For the
Simplified Chinese environment in EUC, the locale must be set to zh
.
zh.GBK
--For
the Simplified Chinese environment in GBK, the locale must be set to zh.GBK
.
zh.UTF-8
--For
the Simplified Chinese environment in Unicode, the locale must be set to zh.UTF-8
.
zh_CN.GB18030
--For
the Simplified Chinese environment in GB18030-2000, the locale must be set
to zh_CN.GB18030
.
A category is a set of features that comprise a locale. For example, character displays or time/date representations, whose behavior depends on the locale. Simplified Chinese Solaris categories include the following:
LC_CTYPE
sets
the character-type for classification and conversion.
LC_TIME
sets the
locale for representation of date and time.
LC_NUMERIC
sets
the number representation locale (used also for I/O).
LC_MONETARY
sets
the currency representation locale.
LC_MESSAGES
sets
the language locale for messages to users.
LC_COLLATE
sets
the locale-dependent collation of strings.
The environmental variable LC_ALL
explicitly sets the same locale for all categories; it has the highest priority.
If categories or LC_ALL
are not
set, the LANG
environmental variable
will determine the category setting.
At the C shell level, each environment variable
can be set to locale (C
for ASCII, zh
for
Simplified Chinese in EUC, zh.GBK
for Simplified Chinese in GBK, zh_CN.GB18030 for Simplified Chinese in GB18030-2000, or zh.UTF-8 for Simplified Chinese
in Unicode) by a shell command as follows:
C shell users can enter a shell command as follows:
system% setenv LC_TIME locale |
Bourne shell (sh) users can use set or export:
$ set -a LC_TIME$ LC_TIME=locale |
or
$ LC_TIME=locale $ export LC_TIME |
Making zh
or zh.GBK
, zh_CN.GB18030,
or zh.UTF-8 the locale allows
the user's environment to display time in Simplified Chinese format and text.
A user can define a mix of locales for the working environment. For example,
characters can be typed and converted in Simplified Chinese, time can be displayed
in French format, and messages can appear in English.
Many users work in a single cultural environment. The LC_ALL
and LANG
environment
variables set the system default for all categories. For example, these C
shell commands set the system default for all categories to locale.
system% setenv LC_All locale system% setenv LANG locale |
System administrators or users can set the default and the setenv syntax can be used in programming.
This setting is put into effect the next time a setlocale() function call in an application program line sets a category to
the default setting: setlocale()(LC_
XXX ""
)