Skip to main content

FluentLocalizerExt

Trait FluentLocalizerExt 

Source
pub trait FluentLocalizerExt: FluentLocalizer {
    // Provided methods
    fn try_localize_message<T>(&self, message: &T) -> Option<String>
       where T: FluentMessage + ?Sized { ... }
    fn localize_message<T>(&self, message: &T) -> String
       where T: FluentMessage + ?Sized { ... }
}
Expand description

Public extension methods for generic explicit localization contexts.

Concrete manager crates expose inherent localize_message(...) methods for application code. Import this trait when integration code works with a generic FluentLocalizer and still needs typed message rendering.

Provided Methods§

Source

fn try_localize_message<T>(&self, message: &T) -> Option<String>
where T: FluentMessage + ?Sized,

Attempts to render a derived typed message through this explicit localizer.

Returns None if any lookup in the message tree is missing. Use this method when missing resources are an expected condition that the caller handles explicitly.

Source

fn localize_message<T>(&self, message: &T) -> String
where T: FluentMessage + ?Sized,

Renders a derived typed message through this explicit localizer.

A key generated under the package-local fallback-str policy returns its snake_case Rust source name. Strict keys still panic.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§