locale — Get locale-specific information
locale [-amvhV] locale [-ck] NAME locale [-usfnU]
System information: -a, --all-locales List all available supported locales -m, --charmaps List all available character maps -v, --verbose More verbose output Modify output format: -c, --category-name List information about given category NAME -k, --keyword-name Print information about given keyword NAME Default locale information: -u, --user Print locale of user's default UI language -s, --system Print locale of system default UI language -f, --format Print locale of user's regional format settings (time, numeric & monetary) -n, --no-unicode Print system default locale for non-Unicode programs -U, --utf Attach \".UTF-8\" to the result Other options: -h, --help This text -V, --version Print program version and exit
locale without parameters prints information about the current locale environment settings.
The -u
, -s
,
-f
, and -n
options can be used to
request the various Windows locale settings. The purpose is to use this
command in scripts to set the POSIX locale variables.
The -u
option prints the current user's Windows UI
locale to stdout. In Windows Vista and Windows 7 this setting is called
the "Display Language"; there was no corresponding user setting in
Windows XP. The -s
option prints the systems default
instead. The -f
option prints the user's setting for
time, date, number and currency. That's equivalent to the setting in the
"Formats" or "Regional Options" tab in the "Region and Language" or
"Regional and Language Options" dialog. With the -U
option locale appends a ".UTF-8".
Usage example:
bash$ export LANG=$(locale -uU) bash$ echo $LANG en_US.UTF-8 bash$ export LC_TIME=$(locale -fU) bash$ echo $LC_TIME de_DE.UTF-8
The -a
option is helpful to learn which locales
are supported by your Windows machine. It prints all available locales
and the allowed modifiers. Example:
bash$ locale -a C C.utf8 POSIX af_ZA af_ZA.utf8 am_ET am_ET.utf8 ... be_BY be_BY.utf8 be_BY@latin ... ca_ES ca_ES.utf8 ca_ES@euro catalan ...
The -v
option prints more detailed information
about each available locale. Example:
bash$ locale -av locale: af_ZA archive: /cygdrive/c/Windows/system32/kernel32.dll ------------------------------------------------------------------------------- language | Afrikaans territory | South Africa codeset | ISO-8859-1 locale: af_ZA.utf8 archive: /cygdrive/c/Windows/system32/kernel32.dll ------------------------------------------------------------------------------- language | Afrikaans territory | South Africa codeset | UTF-8 ... locale: ca_ES@euro archive: /cygdrive/c/Windows/system32/kernel32.dll ------------------------------------------------------------------------------- language | Catalan territory | Spain codeset | ISO-8859-15 locale: catalan archive: /usr/share/locale/locale.alias ------------------------------------------------------------------------------- language | Catalan territory | Spain codeset | ISO-8859-1 ...
The -m
option prints the names of the available
charmaps supported by Cygwin to stdout.
Otherwise, if arguments are given, locale prints
the values assigned to these arguments. Arguments can be names of locale
categories (for instance: LC_CTYPE, LC_MONETARY), or names of keywords
supported in the locale categories (for instance: thousands_sep,
charmap). The -c
option prints additionally the name
of the category. The -k
option prints additionally the
name of the keyword. Example:
bash$ locale -ck LC_MESSAGES LC_MESSAGES yesexpr="^[yY]" noexpr="^[nN]" yesstr="yes" nostr="no" messages-codeset="UTF-8" bash$ locale noexpr ^[nN]