pub trait IStringLocalizer: Send + Sync {
// Required methods
fn default_culture(&self) -> &str;
fn get_in(&self, culture: &str, key: &str) -> LocalizedString;
// Provided methods
fn get(&self, key: &str) -> LocalizedString { ... }
fn resolve_in(&self, culture: &str, text: TextRef) -> LocalizedString { ... }
fn resolve(&self, text: TextRef) -> LocalizedString { ... }
}Expand description
Resolves resource keys for a culture.
The default implementation of Self::get and Self::resolve uses
Self::default_culture, which the host sets from Culture.Default.
Pass an explicit culture only for cross-culture output (for example a
per-culture report); request handling should use the configured default.
Required Methods§
Sourcefn default_culture(&self) -> &str
fn default_culture(&self) -> &str
Culture used when no explicit culture is supplied.
Sourcefn 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.
Provided Methods§
Sourcefn get(&self, key: &str) -> LocalizedString
fn get(&self, key: &str) -> LocalizedString
Resolve key for the default culture.
Sourcefn resolve_in(&self, culture: &str, text: TextRef) -> LocalizedString
fn resolve_in(&self, culture: &str, text: TextRef) -> LocalizedString
Resolve a metadata text reference for culture.
Sourcefn resolve(&self, text: TextRef) -> LocalizedString
fn resolve(&self, text: TextRef) -> LocalizedString
Resolve a metadata text reference for the default culture.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".