Skip to main content

Crate day_fluent

Crate day_fluent 

Source
Expand description

day-fluent — the piece-facing localization layer over the [day_l10n] engine (DESIGN.md §12).

The engine (bundles, the current-locale [Signal], format_in, and the built-in core catalog of standard UI strings) now lives in day-l10n, low enough that the central crates localize their own strings. This crate re-exports that engine and adds the reactive tr() text source: label(tr("greeting").arg("name", name)), whose value re-reads the locale signal plus any signal args, so a locale switch updates every visible string fine-grained, followed by one relayout.

Structs§

LocalizedMark
LocalizedText
A localized text source: label(tr("greeting").arg("name", name)) (§12.2).
SigM
ValM

Enums§

FArg

Traits§

IntoFArg
Disjoint-marker conversion for .arg values (the same E0119 dodge as IntoText).
IntoNumberFArg
Marker for IntoFArg values that carry a number — required for a Fluent variable used as a plural / select selector, where CLDR plural rules select on a number (so a string can’t be passed there by mistake). Implemented for the numeric IntoFArg types only (i64, f64, and their Signals); the generated res::str::<key>(…) functions (§18.5) type such parameters as impl IntoNumberFArg instead of impl IntoFArg.

Functions§

compare
Compare two strings in the CURRENT locale’s collation order. Reads the locale signal (tracked), so a sort inside a reactive closure re-runs when the locale switches.
compare_in
Compare two strings in locale’s collation order (untracked; accepts -u-co- extensions, e.g. "zh-u-co-stroke"). Falls back to code-point order if the locale has no collation data.
format_in
Resolve key: app bundle for the locale, then app-default, then the built-in core catalog for the locale, then core English. en-XA resolves against the default and accents the result. Signal args are tracked reads.
install
Register the app’s locales (see [day_l10n::install]) and fix the layout direction from the locale that actually resolved (docs/localization): an RTL locale (Arabic, Hebrew, …) mirrors every horizontal placement and flips the native toolkit’s direction. Direction is resolved once, before the first layout — runtime set_locale switches strings but not direction.
locale
The current locale (a tracked read inside bindings).
matches_search
matches_search_in against the CURRENT locale. Reads the locale signal (tracked), so a filtered list inside a reactive closure re-filters when the language changes — the same contract crate::compare has.
matches_search_in
Does text match query under locale’s rules? (untracked — pass the locale explicitly).
set_launch_locale
Record the host’s launch locale before [install] runs. Platform glue only — apps pick locales with set_locale. No-op once install has resolved the initial locale.
set_locale
Switch the locale at runtime — every tr/binding re-runs.
sort_localized
Sort a slice in place in the CURRENT locale’s collation order (tracked, like compare).
strip_isolates
Strip Fluent’s FSI/PDI isolation marks (dayscript text comparison, §14.3).
t
Resolve key in the CURRENT locale (no args) — the one-shot form the framework’s own strings use (dialog buttons, menu-role labels), which are resolved once at present/build time.
tr
Day API ↩ Guides· daybrite.dev