pub struct TranslationService {
pub current_locale: String,
}Fields§
§current_locale: StringImplementations§
Source§impl TranslationService
impl TranslationService
pub fn new() -> Self
pub fn set_locale(&mut self, locale: &str)
pub fn t(&self, key: &str) -> String
pub fn t_with_args(&self, key: &str, args: &[(&str, &str)]) -> String
pub fn t_safe(&self, key: &str) -> Result<String, I18nError>
pub fn get_locale(&self) -> &str
pub fn is_locale_supported(&self, locale: &str) -> bool
pub fn get_supported_locales(&self) -> Vec<&'static str>
Trait Implementations§
Source§impl Debug for TranslationService
impl Debug for TranslationService
Auto Trait Implementations§
impl Freeze for TranslationService
impl RefUnwindSafe for TranslationService
impl Send for TranslationService
impl Sync for TranslationService
impl Unpin for TranslationService
impl UnwindSafe for TranslationService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more