Skip to main content

Locale

Struct Locale 

Source
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: char

The decimal separator (. or ,).

§arg_sep: char

The function argument separator (, or ;).

Implementations§

Source§

impl Locale

Source

pub fn en() -> Locale

The canonical locale: English names, . decimal, , separator.

Source

pub fn de() -> Locale

German (de): , decimal, ; separator, LibreOffice’s names.

Source

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.

Source

pub fn from_env() -> Locale

The formula locale named by the environment: IMPROV_LOCALE, else the OS locale (LC_ALL, LC_MESSAGES, LANG).

Source

pub fn canonical_name(&self, local: &str) -> Option<&'static str>

The canonical name a local function name means (case-insensitive).

Source

pub fn local_name<'a>(&self, name: &'a str) -> &'a str

The local name of canonical function name (itself if untranslated).

Source

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.

Source

pub fn localize(&self, text: &str) -> String

The reverse of Self::canonicalize: canonical formula text in this locale’s spelling.

Trait Implementations§

Source§

impl Clone for Locale

Source§

fn clone(&self) -> Locale

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Locale

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Locale

Source§

fn eq(&self, other: &Locale) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Locale

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.