pub struct Locale {
pub code: String,
pub date_order: DateOrder,
pub primary_date_sep: char,
pub lcid: u16,
pub two_digit_year_pivot: u32,
pub default_year: Option<i32>,
}Expand description
A spreadsheet regional locale configuring date and number parsing rules.
Fields§
§code: StringLanguage / country tag (e.g. "en-US", "en-GB", "de-DE", "fr-FR").
date_order: DateOrderPrimary date field ordering.
primary_date_sep: charPrimary date separator ('/', '.' , or '-').
lcid: u16Windows LCID (e.g., 0x0409 for en-US, 0x0809 for en-GB, 0x0407 for de-DE).
two_digit_year_pivot: u322-digit year pivot threshold (default 29 -> 00..29 is 20xx, 30..99 is 19xx).
default_year: Option<i32>Default calendar year for 2-part dates (if None, defaults to 2026).
Implementations§
Source§impl Locale
impl Locale
Sourcepub fn from_code(code: &str) -> Option<Self>
pub fn from_code(code: &str) -> Option<Self>
Look up or construct a locale from a BCP 47 or POSIX language tag.
Recognizes tags like "en-US", "en_US", "en-GB", "de", "de-DE",
"fr", "es", "it", "pt", "nl", "ru", "zh", "ja", etc.
Sourcepub fn default_year(&self) -> i32
pub fn default_year(&self) -> i32
The default year for 2-part dates (e.g. 6/22 or 22-Jun).
Sourcepub fn expand_two_digit_year(&self, year: i32) -> i32
pub fn expand_two_digit_year(&self, year: i32) -> i32
Convert a 2-digit year to a 4-digit year using this locale’s pivot.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Locale
impl<'de> Deserialize<'de> for Locale
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Locale
impl StructuralPartialEq for Locale
Auto Trait Implementations§
impl Freeze for Locale
impl RefUnwindSafe for Locale
impl Send for Locale
impl Sync for Locale
impl Unpin for Locale
impl UnsafeUnpin for Locale
impl UnwindSafe for Locale
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.