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
sourceimpl 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
sourceimpl Clone for DummyTranslator
impl Clone for DummyTranslator
sourcefn clone(&self) -> DummyTranslator
fn clone(&self) -> DummyTranslator
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl RefUnwindSafe for DummyTranslator
impl Send for DummyTranslator
impl Sync for DummyTranslator
impl Unpin for DummyTranslator
impl UnwindSafe for DummyTranslator
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more