pub struct StringLocalizer { /* private fields */ }Expand description
The framework’s default IStringLocalizer: static JSON resource tables.
Implementations§
Source§impl StringLocalizer
impl StringLocalizer
Sourcepub fn new(
default_culture: impl Into<String>,
options: &LocalizationOptions,
) -> Result<Self, String>
pub fn new( default_culture: impl Into<String>, options: &LocalizationOptions, ) -> Result<Self, String>
Build the localizer from the configured resource directory and compiled-in resource entries.
Returns an error naming the file or culture when a resource is not a
JSON object of string → string.
Trait Implementations§
Source§impl IStringLocalizer for StringLocalizer
impl IStringLocalizer for StringLocalizer
Source§fn default_culture(&self) -> &str
fn default_culture(&self) -> &str
Culture used when no explicit culture is supplied.
Source§fn get_in(&self, culture: &str, key: &str) -> LocalizedString
fn get_in(&self, culture: &str, key: &str) -> LocalizedString
Resolve
key for culture, falling back through parent cultures to the
default culture, then returning the key with resource_not_found.Source§fn get(&self, key: &str) -> LocalizedString
fn get(&self, key: &str) -> LocalizedString
Resolve
key for the default culture.Source§fn resolve_in(&self, culture: &str, text: TextRef) -> LocalizedString
fn resolve_in(&self, culture: &str, text: TextRef) -> LocalizedString
Resolve a metadata text reference for
culture.Source§fn resolve(&self, text: TextRef) -> LocalizedString
fn resolve(&self, text: TextRef) -> LocalizedString
Resolve a metadata text reference for the default culture.
Auto Trait Implementations§
impl Forget for StringLocalizer
impl Freeze for StringLocalizer
impl Move for StringLocalizer
impl RefUnwindSafe for StringLocalizer
impl Send for StringLocalizer
impl Sync for StringLocalizer
impl Unpin for StringLocalizer
impl UnsafeUnpin for StringLocalizer
impl UnwindSafe for StringLocalizer
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