pub trait FluentLabel {
// Required methods
fn fluent_label_domain() -> StaticFluentDomain;
fn fluent_label_id() -> StaticFluentEntryId;
// Provided methods
fn try_localize_label<L: FluentLocalizer + ?Sized>(
localizer: &L,
) -> Option<String> { ... }
fn localize_label<L: FluentLocalizer + ?Sized>(localizer: &L) -> String { ... }
fn fallback_label() -> String { ... }
}Expand description
A trait for types that have a Fluent label key representing the type itself.
This trait is automatically implemented by #[derive(EsFluentLabel)] for
source types, and by #[derive(EsFluentVariants)] for each generated
variant enum.
Required Methods§
Sourcefn fluent_label_domain() -> StaticFluentDomain
fn fluent_label_domain() -> StaticFluentDomain
Returns the validated static domain for this type-level label.
Sourcefn fluent_label_id() -> StaticFluentEntryId
fn fluent_label_id() -> StaticFluentEntryId
Returns the validated static message id for this type-level label.
Provided Methods§
Sourcefn try_localize_label<L: FluentLocalizer + ?Sized>(
localizer: &L,
) -> Option<String>
fn try_localize_label<L: FluentLocalizer + ?Sized>( localizer: &L, ) -> Option<String>
Attempts to return the localized label for this type using an explicit localization context.
Sourcefn localize_label<L: FluentLocalizer + ?Sized>(localizer: &L) -> String
fn localize_label<L: FluentLocalizer + ?Sized>(localizer: &L) -> String
Returns the localized label for this type using an explicit localization context.
Sourcefn fallback_label() -> String
fn fallback_label() -> String
Returns deterministic fallback text for this type label without a runtime localization context.
Prefer Self::localize_label when UI code has a runtime manager.
This helper is intended for generated metadata, tests, and integration
scaffolding that cannot access app state.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".