Skip to main content

Module locale

Module locale 

Source
Expand description

Locale tags: their canonical form, which one to use, and the chain a lookup falls back along.

Constants§

ENGLISH
The source language: the English written in the code and in the en catalogue, where every chain ends.
PSEUDO
The pseudo-locale: English, accented and lengthened, to see text that is not translated and layouts that do not absorb longer strings.

Functions§

autonym
A language’s own name (Français for fr), for the common ones; the tag itself otherwise.
chain
The locales a lookup tries, most specific first, ending with English: zh-Hant-TW gives zh-Hant-TW, zh-Hant, zh, en. When the language has no catalogue of its own but a regional one is available (pt-BR for pt-PT), that one is tried after the language. The pseudo-locale reads English.
choose
The locale to use: env (an environment variable’s value), then setting (the user’s choice), then system, then English. A value that names no language is skipped.
language
The language subtag of a locale (fr for fr-CA).
normalize
A locale tag in its canonical form (fr-CA, x-pseudo), from a tag or a POSIX locale name (fr_CA.UTF-8@euro); None when it names no language. C and POSIX are English.
system
The system’s language, if it says.