Struct native_windows_gui::Locale
source · [−]pub struct Locale { /* private fields */ }
Expand description
Represent a Windows locale. Can be used to fetch a lot of information regarding the locale.
Use Locale::user
to fetch the current user local or Local::system
to fetch the system default locale. Using the first one is recommended.
use native_windows_gui as nwg;
let fr_locale = nwg::Locale::from_str("fr");
let en_us_locale = nwg::Locale::from_str("en-US");
let user_locale = nwg::Locale::user();
let locales: Vec<String> = nwg::Locale::all();
user_locale.display_name();
Implementations
sourceimpl Locale
impl Locale
sourcepub fn new(name: String) -> Result<Locale, NwgError>
pub fn new(name: String) -> Result<Locale, NwgError>
Create a new local from a locale name. If you have a str, use from_str
instead.
sourcepub fn from_str<'a>(name: &'a str) -> Result<Locale, NwgError>
pub fn from_str<'a>(name: &'a str) -> Result<Locale, NwgError>
Create a new local from a locale name. If you have a String, use new
instead.
sourcepub fn display_name(&self) -> String
pub fn display_name(&self) -> String
Localized name of locale, eg “German (Germany)” in UI language
sourcepub fn english_display_name(&self) -> String
pub fn english_display_name(&self) -> String
Display name (language + country/region usually) in English, eg “German (Germany)”
sourcepub fn native_display_name(&self) -> String
pub fn native_display_name(&self) -> String
Display name in native locale language, eg “Deutsch (Deutschland)
sourcepub fn country_name(&self) -> String
pub fn country_name(&self) -> String
Localized name of country/region, eg “Germany” in UI language
sourcepub fn english_country_name(&self) -> String
pub fn english_country_name(&self) -> String
English name of country/region, eg “Germany”
sourcepub fn native_country_name(&self) -> String
pub fn native_country_name(&self) -> String
Native name of country/region, eg “Deutschland”
sourcepub fn dialing_code(&self) -> i32
pub fn dialing_code(&self) -> i32
country/region dialing code, example: en-US and en-CA return 1.
sourcepub fn list_separator(&self) -> String
pub fn list_separator(&self) -> String
list item separator, eg “,” for “1,2,3,4”
sourcepub fn measurement_system(&self) -> MeasurementSystem
pub fn measurement_system(&self) -> MeasurementSystem
Returns the measurement system (metric or imperial)
sourcepub fn decimal_separator(&self) -> String
pub fn decimal_separator(&self) -> String
Returns the decimal separator, eg “.” for 1,234.00
sourcepub fn thousand_separator(&self) -> String
pub fn thousand_separator(&self) -> String
Returns the thousand separator, eg “,” for 1,234.00
sourcepub fn digit_grouping(&self) -> String
pub fn digit_grouping(&self) -> String
Returns the digit grouping, eg “3;0” for 1,000,000
sourcepub fn fractional_digit(&self) -> i32
pub fn fractional_digit(&self) -> i32
Returns the number of fractional digits eg 2 for 1.00
sourcepub fn leading_zeros(&self) -> i32
pub fn leading_zeros(&self) -> i32
Returns the number of leading zeros for decimal, 0 for .97, 1 for 0.97
sourcepub fn negative_number_mode(&self) -> NegativeNumberMode
pub fn negative_number_mode(&self) -> NegativeNumberMode
Returns the negative number mode. See the documentation of NegativeNumberMode
sourcepub fn native_digits(&self) -> String
pub fn native_digits(&self) -> String
Returns native digits for 0-9, eg “0123456789”
sourcepub fn currency_symbol(&self) -> String
pub fn currency_symbol(&self) -> String
Returns the local monetary symbol, eg “$”
sourcepub fn intl_monetary_symbol(&self) -> String
pub fn intl_monetary_symbol(&self) -> String
Returns the intl monetary symbol, eg “USD”
sourcepub fn monetary_decimal_separator(&self) -> String
pub fn monetary_decimal_separator(&self) -> String
Returns the monetary decimal separator, eg “.” for 1,234.00
sourcepub fn monetary_thousand_separator(&self) -> String
pub fn monetary_thousand_separator(&self) -> String
Returns the monetary thousand separator, eg “,” for 1,234.00
sourcepub fn monetary_digit_grouping(&self) -> String
pub fn monetary_digit_grouping(&self) -> String
Returns the monetary digit grouping, eg “3;0” for 1,000,000
sourcepub fn monetary_fractional_digit(&self) -> i32
pub fn monetary_fractional_digit(&self) -> i32
Returns the number local monetary digits eg 2 for $1.00
sourcepub fn currency_mode(&self) -> PositiveCurrency
pub fn currency_mode(&self) -> PositiveCurrency
Returns the positive currency mode. See PositiveCurrency
sourcepub fn negative_currency_mode(&self) -> NegativeCurrency
pub fn negative_currency_mode(&self) -> NegativeCurrency
Returns the negative positive currency mode. See NegativeCurrency
sourcepub fn short_date(&self) -> String
pub fn short_date(&self) -> String
Returns the short date format string, eg “MM/dd/yyyy”
sourcepub fn long_date(&self) -> String
pub fn long_date(&self) -> String
Returns the long date format string, eg “dddd, MMMM dd, yyyy”
sourcepub fn calendar2(&self) -> Calendar
pub fn calendar2(&self) -> Calendar
Returns the type of calendar with a bit more precision. Ex: Calendar::GregorianUs
sourcepub fn first_day_of_week(&self) -> i32
pub fn first_day_of_week(&self) -> i32
Returns the first day of week specifier, 0-6, 0=Monday, 6=Sunday
sourcepub fn first_day_of_year(&self) -> FirstDayOfYear
pub fn first_day_of_year(&self) -> FirstDayOfYear
Returns the first day of year specifier. See FirstDayOfYear
sourcepub fn iso_lang_name(&self) -> String
pub fn iso_lang_name(&self) -> String
ISO abbreviated language name, eg “en”
sourcepub fn iso_country_name(&self) -> String
pub fn iso_country_name(&self) -> String
ISO abbreviated country/region name, eg “US”
sourcepub fn currency_name(&self) -> String
pub fn currency_name(&self) -> String
Returns the english name of currency, eg “Euro”
sourcepub fn native_currency_name(&self) -> String
pub fn native_currency_name(&self) -> String
Returns the native name of currency, eg “euro”
sourcepub fn month_name(&self, month_index: u32) -> String
pub fn month_name(&self, month_index: u32) -> String
Return the localized month name. See month_name_abv
for the abbreviated version
Parameters: month_index: The month index. 1(January) to 12 (December) or 13 (if it exists).
Panics: This function will panic if month index in not in the 1-13 range.
sourcepub fn month_name_abv(&self, month_index: u32) -> String
pub fn month_name_abv(&self, month_index: u32) -> String
Return the localized month name in an abbreviated version. See month_name
for the full version
Parameters: month_index: The month index. 1(January) to 12 (December) or 13 (if it exists).
Panics: This function will panic if month index in not in the 1-13 range.
sourcepub fn day_name(&self, day_index: u32) -> String
pub fn day_name(&self, day_index: u32) -> String
Return the localized day name. See day_name_abv
for the abbreviated version
Parameters: day_index: The month index. 1(Monday) to 7 (Sunday)
Panics: This function will panic if month index in not in the 1-7 range.
sourcepub fn day_name_abv(&self, day_index: u32) -> String
pub fn day_name_abv(&self, day_index: u32) -> String
Return the localized day name in an abbreviated version. See day_name
for the full version
Parameters: day_index: The month index. 1(Monday) to 7 (Sunday)
Panics: This function will panic if month index in not in the 1-7 range.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Locale
impl Send for Locale
impl Sync for Locale
impl Unpin for Locale
impl UnwindSafe for Locale
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more