Struct perseus::i18n::DummyTranslator
source · pub struct DummyTranslator;
Expand description
A dummy translator that will be used if an app doesn’t use internationalization. This has literally no capabilities whatsoever, and serves as a blank API interface. If this is called as if it’s a fully-fledged translator, it will panic.
If you’re using i18n, enable the translator-fluent
feature flag to replace
this with FluentTranslator
, which will actually translate things.
Implementations§
source§impl DummyTranslator
impl DummyTranslator
sourcepub fn new(
_locale: String,
_translations_string: String
) -> Result<Self, TranslatorError>
pub fn new( _locale: String, _translations_string: String ) -> Result<Self, TranslatorError>
Creates a new dummy translator, accepting the usual parameters for translators.
sourcepub fn url(&self, _url: &str) -> String
pub fn url(&self, _url: &str) -> String
A dummy function for localizing a URL. This will panic if called.
sourcepub fn get_locale(&self) -> String
pub fn get_locale(&self) -> String
Returns the xx-XX
locale always, which is used by Perseus if i18n is
disabled.
sourcepub fn translate(&self, _id: &str) -> String
pub fn translate(&self, _id: &str) -> String
A dummy function that will NOT translate the given ID! This will panic if called.
sourcepub fn translate_checked<I: Into<String> + Display>(
&self,
_id: &str
) -> Result<String, TranslatorError>
pub fn translate_checked<I: Into<String> + Display>( &self, _id: &str ) -> Result<String, TranslatorError>
A dummy function that will NOT translate the given ID! This will panic if called.
Trait Implementations§
source§impl Clone for DummyTranslator
impl Clone for DummyTranslator
source§fn clone(&self) -> DummyTranslator
fn clone(&self) -> DummyTranslator
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more