Locale (computer software)

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

In computing, a locale is a set of parameters that defines the user's language, region and any special variant preferences that the user wants to see in their user interface. Usually a locale identifier consists of at least a language code and a country/region code.

On POSIX platforms such as Unix, Linux and others, locale identifiers are defined by ISO/IEC 15897, which is similar to the BCP 47 definition of language tags, but the locale variant modifier is defined differently, and the character set is included as a part of the identifier. It is defined in this format: [language[_territory][.codeset][@modifier]]. (For example, Australian English using the UTF-8 encoding is en_AU.UTF-8.)

General locale settings

These settings usually include the following display (output) format settings:

  • Number format setting
  • Character classification, case conversion settings
  • Date-time format setting
  • String collation setting
  • Currency format setting
  • Paper size setting
  • other minor settings ...

The locale settings are about formatting output given a locale. So, the timezone information and daylight saving time are not usually part of the locale settings. Less usual is the input format setting, which is mostly defined on a per application basis.

Furthermore, the general settings usually include the keyboard layout setting.[citation needed]

Programming and markup language support

In these environments,

and other (nowadays) Unicode-based environments, they are defined in a format similar to BCP 47. They are usually defined with just ISO 639 (language) and ISO 3166-1 alpha-2 (2-letter country) codes.

POSIX platforms

On POSIX platforms, locale identifiers are defined by ISO/IEC 15897, which is similar to the BCP 47 definition of language tags, but the locale variant modifier is defined differently, and the character set is included as a part of the identifier.[citation needed]

In the next example there is an output of command locale for Czech language (cs), Czech Republic (CZ) with explicit UTF-8 encoding:

$ locale

Specifics for Microsoft platforms

Windows uses specific language and territory strings. The locale identifier (LCID) for unmanaged code on Microsoft Windows is a number such as 1033 for English (United States) or 1041 for Japanese (Japan). These numbers consist of a language code (lower 10 bits) and culture code (upper bits) and are therefore often written in hexadecimal notation, such as 0x0409 or 0x0411. The list of those codesets are described in character encoding. Microsoft is starting to introduce managed code application programming interfaces (APIs) for .NET that use this format. One of the first to be generally released is a function to mitigate issues with internationalized domain names,[1] but more are in Windows Vista Beta 1.

Starting with Windows Vista, new functions[2] that use BCP 47 locale names have been introduced to replace nearly all LCID-based APIs.

See also


  1. ^ "DownlevelGetLocaleScripts function (Windows)". MSDN. Microsoft. Retrieved 2017-12-11.
  2. ^ "Locale Names (Windows)". MSDN. Microsoft. Retrieved 2017-12-11.

External links

  • BCP 47
  • Language Subtag Registry
  • Common Locale Data Repository
  • java.util.Locale Javadoc API documentation
  • Locale and Language information from Microsoft
  • MS-LCID: Windows Language Code Identifier (LCID) Reference from Microsoft
  • Microsoft LCID list
  • Microsoft LCID chart with decimal equivalents
  • POSIX Environment Variables
  • Low Level Technical details on defining a POSIX locale
  • ICU Locale Explorer
  • Debian Wiki on Locales
  • Article "The Standard C++ Locale" by Nathan C. Myers
  • locale(7): Description of multi-language support - Linux man page
  • Apache C++ Standard Library Locale User's Guide
  • Sort order charts for various operating system locales and database collations
  • NATSPEC Library
  • Description of locale-related UNIX environment variables in Debian Linux Reference Manual
  • Guides to locales and locale creation on various platforms
Retrieved from "https://en.wikipedia.org/w/index.php?title=Locale_(computer_software)&oldid=865595005"
This content was retrieved from Wikipedia : http://en.wikipedia.org/wiki/Locale_(computer_software)
This page is based on the copyrighted Wikipedia article "Locale (computer software)"; it is used under the Creative Commons Attribution-ShareAlike 3.0 Unported License (CC-BY-SA). You may redistribute it, verbatim or modified, providing that you comply with the terms of the CC-BY-SA