[][src]Struct native_windows_gui::Locale

pub struct Locale { /* fields omitted */ }

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

impl Locale[src]

pub fn new(name: String) -> Result<Locale, NwgError>[src]

Create a new local from a locale name. If you have a str, use from_str instead.

pub fn from_str<'a>(name: &'a str) -> Result<Locale, NwgError>[src]

Create a new local from a locale name. If you have a String, use new instead.

pub fn all() -> Vec<String>[src]

Return the identifier (ex: en-US) of every supported locales.

pub fn user() -> Locale[src]

Return the current user locale

pub fn system() -> Locale[src]

Return the current system locale

pub fn name(&self) -> &str[src]

Return the name of the locale.

pub fn display_name(&self) -> String[src]

Localized name of locale, eg "German (Germany)" in UI language

pub fn english_display_name(&self) -> String[src]

Display name (language + country/region usually) in English, eg "German (Germany)"

pub fn native_display_name(&self) -> String[src]

Display name in native locale language, eg "Deutsch (Deutschland)

pub fn country_name(&self) -> String[src]

Localized name of country/region, eg "Germany" in UI language

pub fn english_country_name(&self) -> String[src]

English name of country/region, eg "Germany"

pub fn native_country_name(&self) -> String[src]

Native name of country/region, eg "Deutschland"

pub fn dialing_code(&self) -> i32[src]

country/region dialing code, example: en-US and en-CA return 1.

pub fn list_separator(&self) -> String[src]

list item separator, eg "," for "1,2,3,4"

pub fn measurement_system(&self) -> MeasurementSystem[src]

Returns the measurement system (metric or imperial)

pub fn decimal_separator(&self) -> String[src]

Returns the decimal separator, eg "." for 1,234.00

pub fn thousand_separator(&self) -> String[src]

Returns the thousand separator, eg "," for 1,234.00

pub fn digit_grouping(&self) -> String[src]

Returns the digit grouping, eg "3;0" for 1,000,000

pub fn fractional_digit(&self) -> i32[src]

Returns the number of fractional digits eg 2 for 1.00

pub fn leading_zeros(&self) -> i32[src]

Returns the number of leading zeros for decimal, 0 for .97, 1 for 0.97

pub fn negative_number_mode(&self) -> NegativeNumberMode[src]

Returns the negative number mode. See the documentation of NegativeNumberMode

pub fn native_digits(&self) -> String[src]

Returns native digits for 0-9, eg "0123456789"

pub fn currency_symbol(&self) -> String[src]

Returns the local monetary symbol, eg "$"

pub fn intl_monetary_symbol(&self) -> String[src]

Returns the intl monetary symbol, eg "USD"

pub fn monetary_decimal_separator(&self) -> String[src]

Returns the monetary decimal separator, eg "." for 1,234.00

pub fn monetary_thousand_separator(&self) -> String[src]

Returns the monetary thousand separator, eg "," for 1,234.00

pub fn monetary_digit_grouping(&self) -> String[src]

Returns the monetary digit grouping, eg "3;0" for 1,000,000

pub fn monetary_fractional_digit(&self) -> i32[src]

Returns the number local monetary digits eg 2 for $1.00

pub fn currency_mode(&self) -> PositiveCurrency[src]

Returns the positive currency mode. See PositiveCurrency

pub fn negative_currency_mode(&self) -> NegativeCurrency[src]

Returns the negative positive currency mode. See NegativeCurrency

pub fn short_date(&self) -> String[src]

Returns the short date format string, eg "MM/dd/yyyy"

pub fn long_date(&self) -> String[src]

Returns the long date format string, eg "dddd, MMMM dd, yyyy"

pub fn time(&self) -> String[src]

Returns the time format string, eg "HH:mm:ss"

pub fn am(&self) -> String[src]

Returns the AM designator, eg "AM"

pub fn pm(&self) -> String[src]

Returns the PM designator, eg "PM"

pub fn calendar(&self) -> Calendar[src]

Returns the type of calendar. Ex: Calendar::Gregorian

pub fn calendar2(&self) -> Calendar[src]

Returns the type of calendar with a bit more precision. Ex: Calendar::GregorianUs

pub fn first_day_of_week(&self) -> i32[src]

Returns the first day of week specifier, 0-6, 0=Monday, 6=Sunday

pub fn first_day_of_year(&self) -> FirstDayOfYear[src]

Returns the first day of year specifier. See FirstDayOfYear

pub fn iso_lang_name(&self) -> String[src]

ISO abbreviated language name, eg "en"

pub fn iso_country_name(&self) -> String[src]

ISO abbreviated country/region name, eg "US"

pub fn currency_name(&self) -> String[src]

Returns the english name of currency, eg "Euro"

pub fn native_currency_name(&self) -> String[src]

Returns the native name of currency, eg "euro"

pub fn month_name(&self, month_index: u32) -> String[src]

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.

pub fn month_name_abv(&self, month_index: u32) -> String[src]

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.

pub fn day_name(&self, day_index: u32) -> String[src]

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.

pub fn day_name_abv(&self, day_index: u32) -> String[src]

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

impl Clone for Locale[src]

impl Debug for Locale[src]

impl Display for Locale[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.