pub struct Locale { /* private fields */ }Expand description
Locale is a “place-holder” around what will eventually be a fluent::FluentBundle
Implementations§
Source§impl Locale
impl Locale
Sourcepub fn new_static(id: LanguageIdentifier, str: &'static str) -> Self
pub fn new_static(id: LanguageIdentifier, str: &'static str) -> Self
Create a Locale from a static string containing Fluent (.ftl) content.
Typically used with include_str! to embed locale files at compile time.
Sourcepub fn new_dynamic(id: LanguageIdentifier, path: impl Into<PathBuf>) -> Self
pub fn new_dynamic(id: LanguageIdentifier, path: impl Into<PathBuf>) -> Self
Create a Locale from a filesystem path to a Fluent (.ftl) file.
The file will be read at runtime when the locale is loaded into a bundle.
Trait Implementations§
Source§impl<T> From<(LanguageIdentifier, T)> for Localewhere
T: Into<LocaleResource>,
impl<T> From<(LanguageIdentifier, T)> for Localewhere
T: Into<LocaleResource>,
Source§fn from((id, resource): (LanguageIdentifier, T)) -> Self
fn from((id, resource): (LanguageIdentifier, T)) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Locale
impl RefUnwindSafe for Locale
impl Send for Locale
impl Sync for Locale
impl Unpin for Locale
impl UnsafeUnpin for Locale
impl UnwindSafe for Locale
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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