Skip to main content

FluentLabel

Trait FluentLabel 

Source
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§

Source

fn fluent_label_domain() -> StaticFluentDomain

Returns the validated static domain for this type-level label.

Source

fn fluent_label_id() -> StaticFluentEntryId

Returns the validated static message id for this type-level label.

Provided Methods§

Source

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.

Source

fn localize_label<L: FluentLocalizer + ?Sized>(localizer: &L) -> String

Returns the localized label for this type using an explicit localization context.

Source

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".

Implementors§