Skip to main content

Backend

Trait Backend 

Source
pub trait Backend:
    Send
    + Sync
    + 'static {
    // Required methods
    fn available_locales(&self) -> Vec<Cow<'_, str>>;
    fn translate(&self, locale: &str, key: &str) -> Option<Cow<'_, str>>;
    fn messages_for_locale(
        &self,
        locale: &str,
    ) -> Option<Vec<(Cow<'_, str>, Cow<'_, str>)>>;
}
Expand description

I18n backend trait

Required Methods§

Source

fn available_locales(&self) -> Vec<Cow<'_, str>>

Return the available locales

Source

fn translate(&self, locale: &str, key: &str) -> Option<Cow<'_, str>>

Get the translation for the given locale and key

Source

fn messages_for_locale( &self, locale: &str, ) -> Option<Vec<(Cow<'_, str>, Cow<'_, str>)>>

Get all translations for the given locale

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§