pub struct Locale {
pub tag: &'static str,
pub decimal: char,
pub arg_sep: char,
/* private fields */
}Expand description
A formula locale.
Fields§
§tag: &'static str§decimal: charThe decimal separator (. or ,).
arg_sep: charThe function argument separator (, or ;).
Implementations§
Source§impl Locale
impl Locale
Sourcepub fn from_tag(tag: &str) -> Locale
pub fn from_tag(tag: &str) -> Locale
The locale for a tag such as de, de_DE.UTF-8 or en-US; English
for anything unknown.
Sourcepub fn from_env() -> Locale
pub fn from_env() -> Locale
The formula locale named by the environment: IMPROV_LOCALE, else
the OS locale (LC_ALL, LC_MESSAGES, LANG).
Sourcepub fn canonical_name(&self, local: &str) -> Option<&'static str>
pub fn canonical_name(&self, local: &str) -> Option<&'static str>
The canonical name a local function name means (case-insensitive).
Sourcepub fn local_name<'a>(&self, name: &'a str) -> &'a str
pub fn local_name<'a>(&self, name: &'a str) -> &'a str
The local name of canonical function name (itself if untranslated).
Sourcepub fn canonicalize(&self, text: &str) -> String
pub fn canonicalize(&self, text: &str) -> String
Rewrite formula text typed in this locale into the canonical
language: numbers’ decimal separator to ., the argument separator to
,, and translated function names (a word directly before () to
their canonical names. Text in double quotes, quoted names in single
quotes and date literals in #…# are left exactly as typed.
Sourcepub fn localize(&self, text: &str) -> String
pub fn localize(&self, text: &str) -> String
The reverse of Self::canonicalize: canonical formula text in this
locale’s spelling.