Skip to main content

Module region

Module region 

Expand description

The person’s region and formats, as every formatter reads them: the locale section of their settings (date style, 12/24-hour clock, number style, first day of the week) next to the desktop’s language.

The section is read once and cached for the whole process. A host calls refresh when its settings change (the toolkit’s app host and the shell do, on the same settings stamp that re-themes them); a change bumps revision, which crate::i18n::I18nManager::revision folds in, so every view and retained widget that follows the language re-renders its dates and numbers in the new formats without a restart.

Structs§

RegionFormats
The formats a person chose in Region & Formats. number is None until they choose a number style; the language’s own convention applies then.

Enums§

DateStyle
How dates render: the shared locale.date_format setting. The serde names are the exact strings the settings file uses (Language/ISO/US/EU/Long). Until the person picks one, dates follow the desktop’s language (DateStyle::Language); ISO is a choice like the others.
FirstDayOfWeek
The day a week starts on, for every calendar grid and week number.
NumberStyle
Decimal and grouping convention. Kept apart from the currency so someone can use EUR with either continental or English-language formatting.

Functions§

current
The person’s formats, read from their settings on first use and kept until the next refresh.
install
Use formats from now on, as refresh would after reading them. For hosts that hold the settings document themselves, and for tests.
refresh
Read the person’s formats again. Returns whether they changed; a change bumps revision so views re-render with them. Hosts call this when their settings change.
revision
Changes whenever the person’s formats change.