Skip to main content

Module locale

Module locale 

Source
Expand description

Locale — per-tenant locale registry.

Drives the language picker on every page edit form and the locale FK on cms_translation. Exactly one row carries is_default = true; the admin form enforces that invariant when toggling.

Structs§

Locale
One row per active locale on the tenant. code follows BCP-47 (e.g. en, fr-CA, pt-BR).

Functions§

validate_code
Validate + normalize a BCP-47-ish locale code for the cms_locale registry. Content locales may be any well-formed tag — core provides metadata + graceful fallback via rustango::i18n::locale_info — but the tag must be structurally sane so it matches Accept-Language, keys translations predictably, and fits the 16-char column. Normalizes _→-, language→lowercase, script→Titlecase, region→UPPERCASE. Returns the normalized code, or a human-readable error message.