Trait perseus::translations_manager::TranslationsManager [−][src]
pub trait TranslationsManager: Clone {
fn get_translator_for_locale<'life0, 'async_trait>(
&'life0 self,
locale: String
) -> Pin<Box<dyn Future<Output = Result<Translator, TranslationsManagerError>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn get_translations_str_for_locale<'life0, 'async_trait>(
&'life0 self,
locale: String
) -> Pin<Box<dyn Future<Output = Result<String, TranslationsManagerError>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
}
Expand description
A trait for systems that manage where to put translations. At simplest, we’ll just write them to static files, but they might also
be stored in a CMS. It is strongly advised that any implementations use some form of caching, guided by FsTranslationsManager
.
Required methods
fn get_translator_for_locale<'life0, 'async_trait>(
&'life0 self,
locale: String
) -> Pin<Box<dyn Future<Output = Result<Translator, TranslationsManagerError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn get_translator_for_locale<'life0, 'async_trait>(
&'life0 self,
locale: String
) -> Pin<Box<dyn Future<Output = Result<Translator, TranslationsManagerError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Gets a translator for the given locale.
fn get_translations_str_for_locale<'life0, 'async_trait>(
&'life0 self,
locale: String
) -> Pin<Box<dyn Future<Output = Result<String, TranslationsManagerError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn get_translations_str_for_locale<'life0, 'async_trait>(
&'life0 self,
locale: String
) -> Pin<Box<dyn Future<Output = Result<String, TranslationsManagerError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Gets the translations in string format for the given locale (avoids deserialize-then-serialize).