All locale information is accessible to programs at run time so that data is processed and displayed correctly for specific cultural conventions and language.
A locale is divided into categories. A category is a group of language-specific and culture-specific conventions as outlined in the list above. ISO C specifies the following six standard categories supported by
NetBSD:
LC_COLLATE
string-collation order information
LC_CTYPE
character classification, case conversion, and other character attributes
LC_MESSAGES
the format for affirmative and negative responses
LC_MONETARY
rules and symbols for formatting monetary numeric information
LC_NUMERIC
rules and symbols for formatting nonmonetary numeric information
LC_TIME
rules and symbols for formatting time and date information
Localization of the system is achieved by setting appropriate values in environment variables to identify which locale should be used. The environment variables have the same names as their respective locale categories. Additionally, the
LANG,
LC_ALL, and
NLSPATH environment variables are used. The
NLSPATH environment variable specifies a colon-separated list of directory names where the message catalog files of the NLS database are located. The
LC_ALL and
LANG environment variables also determine the current locale.
The values of these environment variables contains a string format as:
language[_territory][.codeset][@modifier]
Valid values for the language field come from the ISO639 standard which defines two-character codes for many languages. Some common language codes are:
Language Name
Code
Language Family
ABKHAZIAN
AB
IBERO-CAUCASIAN
ALBANIAN
SQ
INDO-EUROPEAN (OTHER)
ARMENIAN
HY
INDO-EUROPEAN (OTHER)
AZERBAIJANI
AZ
TURKIC/ALTAIC
ESPERANTO
EO
INTERNATIONAL AUX.
FIJI
FJ
OCEANIC/INDONESIAN
GEORGIAN
KA
IBERO-CAUCASIAN
INDONESIAN
ID
OCEANIC/INDONESIAN
INTERLINGUA
IA
INTERNATIONAL AUX.
INTERLINGUE
IE
INTERNATIONAL AUX.
JAVANESE
JV
OCEANIC/INDONESIAN
KINYARWANDA
RW
NEGRO-AFRICAN
MALAGASY
MG
OCEANIC/INDONESIAN
MALAY
MS
OCEANIC/INDONESIAN
MAORI
MI
OCEANIC/INDONESIAN
PERSIAN (farsi)
FA
IRANIAN
RHAETO-ROMANCE
RM
ROMANCE
SAMOAN
SM
OCEANIC/INDONESIAN
SETSWANA
TN
NEGRO-AFRICAN
SUNDANESE
SU
OCEANIC/INDONESIAN
TAGALOG
TL
OCEANIC/INDONESIAN
TONGA
TO
OCEANIC/INDONESIAN
VOLAPUK
VO
INTERNATIONAL AUX.
For example, the locale for the Danish language spoken in Denmark using the ISO 8859-1 character set is da_DK.ISO8859-1. The da stands for the Danish language and the DK stands for Denmark. The short form of da_DK is sufficient to indicate this locale.
The environment variable settings are queried by their priority level in the following manner:
•
If the LC_ALL environment variable is set, all six categories use the locale it specifies.
•
If the LC_ALL environment variable is not set, each individual category uses the locale specified by its corresponding environment variable.
•
If the LC_ALL environment variable is not set, and a value for a particular LC_* environment variable is not set, the value of the LANG environment variable specifies the default locale for all categories. Only the LANG environment variable should be set in /etc/profile, since it makes it most easy for the user to override the system default using the individual LC_* variables.
•
If the LC_ALL environment variable is not set, a value for a particular LC_* environment variable is not set, and the value of the LANG environment variable is not set, the locale for that specific category defaults to the C locale. The C or POSIX locale assumes the ASCII character set and defines information for the six categories.