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 localize_message(...) when a message ID fallback is desired instead.

Source

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

Renders a derived typed message through this explicit localizer.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§