Struct perseus::translations_manager::FsTranslationsManager [−][src]
pub struct FsTranslationsManager { /* fields omitted */ }
Expand description
The default translations manager. This will store static files in the specified location on disk. This should be suitable for nearly all development and serverful use-cases. Serverless is another matter though (more development needs to be done). This mandates that translations be stored as files named as the locale they describe (e.g. ‘en-US.ftl’, ‘en-US.json’, etc.).
Implementations
Creates a new filesystem translations manager. You should provide a path like /translations
here. You should also provide
the locales you want to cache, which will have their translations stored in memory. Any supported locales not specified here
will not be cached, and must have their translations read from disk on every request. If fetching translations for any of the
given locales fails, this will panic (locales to be cached should always be hardcoded).
Trait Implementations
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).
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.
Auto Trait Implementations
impl RefUnwindSafe for FsTranslationsManager
impl Send for FsTranslationsManager
impl Sync for FsTranslationsManager
impl Unpin for FsTranslationsManager
impl UnwindSafe for FsTranslationsManager
Blanket Implementations
Mutably borrows from an owned value. Read more