ArticleslgStudy

computer science

Locale (computer software)

Locale (computer software) is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Locale (computer software) rather than just read about it. In short: 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.

Key takeaways

  • Locale (computer software) belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Locale (computer software) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Locale (computer software) from memory before moving on to harder problems.

Reference excerpt

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. Locale is an important aspect of internationalization.

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

Number format setting (LC_NUMERIC, C/C++) Character classification, case conversion settings (LC_CTYPE, C/C++) Date-time format setting (LC_TIME, C/C++) String collation setting (LC_COLLATE, C/C++) Currency format setting (LC_MONETARY, C/C++) Paper size setting (LC_PAPER, ISO 30112) Color temperature setting UI font setting (especially for CJKV language) Location setting (country or region) ANSI character set setting (for Microsoft Windows) The locale settings are about formatting output given a locale. So, the time zone 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.

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.

International standards In standard C and C++, locale is defined in "categories" of LC_COLLATE (text collation), LC_CTYPE (character class), LC_MONETARY (currency format), LC_NUMERIC (number format), and LC_TIME (time format). The special LC_ALL category can be used to set all locale settings. There are no standard locale names associated with C and C++ standards besides a "minimal locale" name "C", although the POSIX format is a commonly used baseline.

POSIX platforms On POSIX platforms such as Unix, Linux and others, locale identifiers are defined in a way similar to the BCP 47 definition of language tags, but the locale variant modifier is defined differently, and the character set is optionally included as a part of the identifier. The POSIX or "XPG" format is [language[_territory][.codeset][@modifier]]. For example, Australian English using the UTF-8 encoding is en_AU.UTF-8. The modifier can include any implementation-defined feature such as @euro for the use of the Euro sign as currency symbol. In the next example there is an output of command locale for Czech language (cs), Czech Republic (CZ) with explicit UTF-8 encoding:

$ locale LANG=cs_CZ.UTF-8 LC_CTYPE="cs_CZ.UTF-8" LC_NUMERIC="cs_CZ.UTF-8" LC_TIME="cs_CZ.UTF-8" LC_COLLATE="cs_CZ.UTF-8" LC_MONETARY="cs_CZ.UTF-8" LC_MESSAGES="cs_CZ.UTF-8" LC_PAPER="cs_CZ.UTF-8" LC_NAME="cs_CZ.UTF-8" LC_ADDRESS="cs_CZ.UTF-8" LC_TELEPHONE="cs_CZ.UTF-8" LC_MEASUREMENT="cs_CZ.UTF-8" LC_IDENTIFICATION="cs_CZ.UTF-8" LC_ALL=

Separately, ISO/IEC 15897 describes a different form, language_territory+audience+application,sponsor_version, though it's highly dubious whether it is used at all.

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 2057 for English (United Kingdom), or 1041 for Japanese (Japan). These numbers consist of a language code (lower 10 bits) and a culture code (upper bits), and are therefore often written in hexadecimal notation, such as 0x0409, 0x0809 or 0x0411. 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, but more are in Windows Vista Beta 1. Starting with Windows Vista, new functions that use BCP 47 locale names have been introduced to replace nearly all LCID-based APIs. A POSIX-like locale name format of language[_country-region[.code-page]] is available in the UCRT (Universal C Run Time) of Windows 10 and 11.

See also Internationalization and localization ISO 639 language codes ISO 3166-1 alpha-2 region codes ISO 15924 script codes IETF language tag C localization functions CCSID Code page Common Locale Data Repository Date and time representation by country AppLocale

References

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

Worked examples

Example 1 — a first encounter with Locale (computer software)

Start with the simplest possible case. Write down what Locale (computer software) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Locale (computer software) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Locale (computer software) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Locale (computer software)

In research
Locale (computer software) appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Locale (computer software) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Locale (computer software) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Internationalization and localization, Unix SUS2008 utilities, Unix user management and support-related utilities, so understanding it makes those chapters shorter.
In everyday life
Look for Locale (computer software) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Locale (computer software)” →

How to study Locale (computer software) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Locale (computer software) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Locale (computer software) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Locale (computer software) in simple terms?

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.

Why does Locale (computer software) matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Locale (computer software)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Locale (computer software).

Tags

  • Internationalization and localization
  • Unix SUS2008 utilities
  • Unix user management and support-related utilities

Keep exploring