pub struct Localizer { /* private fields */ }Expand description
Immutable access to eska’s embedded translations.
Implementations§
Source§impl Localizer
impl Localizer
Sourcepub fn try_new(locale: Locale) -> Result<Self, LocalizationError>
pub fn try_new(locale: Locale) -> Result<Self, LocalizationError>
Creates a localizer from the translation resource embedded in the binary.
§Errors
This can fail only if an embedded resource or its canonical locale identifier is invalid. Tests validate both resources so installation needs no external files.
Source§impl Localizer
impl Localizer
Sourcepub fn property_caption(
&self,
owner: Option<MetadataKind>,
key: &PropertyKey,
) -> Option<String>
pub fn property_caption( &self, owner: Option<MetadataKind>, key: &PropertyKey, ) -> Option<String>
Resolve contextual captions first, retaining QName boundaries for unknown extensions.
Source§impl Localizer
impl Localizer
Sourcepub fn property_value_caption(
&self,
owner: MetadataKind,
root: &PropertyKey,
path: &[&PropertyKey],
key: &PropertyKey,
text: &str,
) -> Option<String>
pub fn property_value_caption( &self, owner: MetadataKind, root: &PropertyKey, path: &[&PropertyKey], key: &PropertyKey, text: &str, ) -> Option<String>
Translate only a token belonging to the field’s known enum domain.
Sourcepub fn enum_caption(&self, domain: &str, token: &str) -> Option<String>
pub fn enum_caption(&self, domain: &str, token: &str) -> Option<String>
Preserve unknown enum tokens, including future platform additions.
Sourcepub fn typed_value_caption(
&self,
key: &PropertyKey,
text: &str,
) -> Option<String>
pub fn typed_value_caption( &self, key: &PropertyKey, text: &str, ) -> Option<String>
XML value annotations select a closed enum domain independently of prefix spelling.
Sourcepub fn type_caption(&self, key: &PropertyKey) -> Option<String>
pub fn type_caption(&self, key: &PropertyKey) -> Option<String>
Resolve built-in XML type names using namespace URIs, independent of prefix spelling.
Sourcepub fn qualifier_caption(
&self,
field: &PropertyKey,
qualifier: &PropertyKey,
text: &str,
) -> Option<String>
pub fn qualifier_caption( &self, field: &PropertyKey, qualifier: &PropertyKey, text: &str, ) -> Option<String>
Standard-attribute identities are platform vocabulary; arbitrary object names are not.