Next: , Previous: , Up: Locales and Internationalization   [Contents][Index]


7.2 Choosing a Locale

The simplest way for the user to choose a locale is to set the environment variable LANG. This specifies a single locale to use for all purposes. For example, a user could specify a hypothetical locale named ‘espana-castellano’ to use the standard conventions of most of Spain.

The set of locales supported depends on the operating system you are using, and so do their names, except that the standard locale called ‘C’ or ‘POSIX’ always exist. See Locale Names.

In order to force the system to always use the default locale, the user can set the LC_ALL environment variable to ‘C’.

A user also has the option of specifying different locales for different purposes—in effect, choosing a mixture of multiple locales. See Locale Categories.

For example, the user might specify the locale ‘espana-castellano’ for most purposes, but specify the locale ‘usa-english’ for currency formatting. This might make sense if the user is a Spanish-speaking American, working in Spanish, but representing monetary amounts in US dollars.

Note that both locales ‘espana-castellano’ and ‘usa-english’, like all locales, would include conventions for all of the purposes to which locales apply. However, the user can choose to use each locale for a particular subset of those purposes.