gui/i18n/config

Locale registry + resolution for the SPA's react-intl setup.

The project ships English as the only fully-authored locale (the app is dense with domain jargon — DPL, prompt "salt", wrappers, expansions, dynamic- prompt tokens — that machine translation handles poorly, so we don't ship low-quality languages). The whole pipeline is in place, though: adding a real language is a one-file job (drop a compiled catalog in compiled/<locale>.json and register it here). en-XA is a generated pseudo-locale — accented, padded English — kept available so anyone can flip to it and instantly see any string that was missed (still plain English = not internationalized yet).

Description:
  • Locale registry + resolution for the SPA's react-intl setup.

    The project ships English as the only fully-authored locale (the app is dense with domain jargon — DPL, prompt "salt", wrappers, expansions, dynamic- prompt tokens — that machine translation handles poorly, so we don't ship low-quality languages). The whole pipeline is in place, though: adding a real language is a one-file job (drop a compiled catalog in compiled/<locale>.json and register it here). en-XA is a generated pseudo-locale — accented, padded English — kept available so anyone can flip to it and instantly see any string that was missed (still plain English = not internationalized yet).

Source:

Members

(static, constant) AUTO_LOCALE :string

Description:
  • The special "follow the browser" sentinel stored in settings when the user has not pinned a language. Resolves through resolveLocale.

Source:

The special "follow the browser" sentinel stored in settings when the user has not pinned a language. Resolves through resolveLocale.

Type:
  • string

(static, constant) DEFAULT_LOCALE

Description:
  • The source locale: messages are authored in English (inline defaultMessage).

Source:

The source locale: messages are authored in English (inline defaultMessage).

(static, constant) LOCALES :Object.<string, {label: string, dir: ("ltr"|"rtl")}>

Description:
  • Registry of selectable locales: code → display metadata. label is the endonym (shown in the switcher as-is, untranslated on purpose); dir drives the document text direction. Add a real language here once a compiled/<code>.json catalog exists for it.

Source:

Registry of selectable locales: code → display metadata. label is the endonym (shown in the switcher as-is, untranslated on purpose); dir drives the document text direction. Add a real language here once a compiled/<code>.json catalog exists for it.

Type:
  • Object.<string, {label: string, dir: ("ltr"|"rtl")}>

(inner, constant) All :Array.<string>

Description:
  • registered locale codes.

Source:

registered locale codes.

Type:
  • Array.<string>

Methods

(static) dirFor(locale) → {"ltr"|"rtl"}

Source:
Parameters:
Name Type Description
locale string

A locale code.

Returns:

The text direction for the locale (defaults to ltr).

Type
"ltr" | "rtl"

(static) isSupported(locale) → {boolean}

Source:
Parameters:
Name Type Description
locale string

A locale code.

Returns:

Whether it is a registered, selectable locale.

Type
boolean

(static) resolveLocale(prefopt) → {string}

Description:
  • Resolve a stored preference (a locale code, ""/"auto", or junk) plus the browser's languages into a concrete supported locale.

Source:
Parameters:
Name Type Attributes Description
pref string <optional>

The stored settings.locale preference.

Returns:

A code guaranteed to be in SUPPORTED_LOCALES.

Type
string