Skip to main content

Crate teksilo_i18n

Crate teksilo_i18n 

Source
Expand description

Internationalization runtime for Teksilo.

Implements §12 of docs/architecture.md. This crate is the runtime half of the i18n stack: LocalizedString, I18nConfig, I18nManager, locale resolution, and the thread-local that bridges macro-expanded code into the active translation bundles.

The compile-time tr! / tr_widget! proc macros live in the sister teksilo-i18n-macros crate (Phase C) and are re-exported here as part of teksilo-i18n’s public surface.

Re-exports§

pub use config::I18nConfig;
pub use direction::rtl_from_locale;
pub use display_names::language_endonym;
pub use file_watcher::FtlFileWatcher;
pub use file_watcher::ReloadSink;
pub use format::CalendarSystem;
pub use format::DateFields;
pub use format::DateStyle;
pub use format::NumberFormatter;
pub use format::NumberStyle;
pub use format::NumberSymbols;
pub use format::TeksiloDateTime;
pub use format::TeksiloDateTimeFormatter;
pub use format::TimeStyle;
pub use format::delocalize_number;
pub use localized_string::LocalizedString;
pub use localized_string::localized;
pub use manager::I18nManager;
pub use manager::LocaleSwitchOutcome;
pub use manager::ReloadError;
pub use resolve::resolve_message;
pub use resolve::resolve_message_widget;

Modules§

config
I18nConfig — application-facing builder for the i18n runtime.
direction
Layout direction derivation from a LanguageIdentifier.
display_names
Locale display names — language endonyms.
file_watcher
notify-based hot-reload watcher for runtime_override .ftl files.
format
Locale-aware number and date/time formatting.
localized_string
LocalizedString — the developer-facing handle the tr! macro produces.
manager
I18nManager — owns Fluent bundles and the active-locale signals.
resolve
Free functions the tr! / tr_widget! macros expand into.

Macros§

compile_in_locales
Declarative sugar for populating I18nConfig::compile_in when an application ships many locales × many .ftl files per locale.
lit
Wrap an intentionally untranslated string as a LocalizedString.
tr
Compile-time-validating translation macro for application strings.
tr_signal
Reactive variant of tr! for the Signal<T>-inside-translated-sentence case. Every named argument expression must evaluate to a Signal<T> where T: Clone + 'static + Into<FluentValue<'static>>. Returns a Signal<String> that re-renders on (any arg change ∪ locale change ∪ .ftl hot reload).
tr_signal_widget
Reactive variant of tr_widget!. Same arg shape as tr_signal!.
tr_widget
Compile-time-validating translation macro for framework-internal strings. Same surface as tr!, but routes to the framework bundle at runtime. Only used inside teksilo-widgets.

Structs§

LanguageIdentifier
LanguageIdentifier is a core struct representing a Unicode Language Identifier.
Signal
A reactive value. Created via Signal::new(value) for mutable signals or signal.map(f) for derived (read-only) signals.
WeakSignal
Weak reference to a mutable signal. Produced by Signal::downgrade.

Enums§

FluentValue
The FluentValue enum represents values which can be formatted to a String.
LayoutDirection
Layout direction for RTL/LTR support.

Functions§

current_direction
Clone of the active manager’s layout direction signal, or None if no manager is installed.
current_locale
Clone of the active manager’s locale signal, or None if no manager is installed.
current_supported_locales
Snapshot the supported-locales list from the active manager. Returns None if no manager is installed.
current_version_signal
Clone of the active manager’s version signal, or None if no manager is installed.