ICultureDataProvider
trait · ferroui-base · v0.5.0
trait ICultureDataProvider: 'static
Supplies the conventions of cultures by locale. Register an implementation with the locator:
FerroLocator::current_mutable().bind::<dyn ICultureDataProvider>().to_constant(provider);
A provider is asked on every use of a culture, so it should hand out
shared instances it keeps. The locale it is asked for is never the
unknown locale und (the invariant culture, whose data is built in);
a culture without data of its own is asked for the parents of its
locale next (en-GB after en-GB-u-hc-h12, en after en-GB).
Members
get_date_time_format_by_localeget_number_format_by_localeget_compare_rules_by_localeget_text_info_by_localeget_localesget_date_time_formatget_number_formatget_compare_rulesget_text_infoget_culture_names
get_date_time_format_by_locale
fn get_date_time_format_by_locale(self: &Self, locale: &Locale) -> Option<Rc<DateTimeFormatInfo>>
The date and time conventions of locale, or None when the
provider has no data for it (the parent locale is asked next).
The default asks get_date_time_format
with the BCP-47 text of the locale.
get_number_format_by_locale
fn get_number_format_by_locale(self: &Self, locale: &Locale) -> Option<Rc<NumberFormatInfo>>
The number conventions of locale, or None when the provider has
no data for it (the parent locale is asked next).
The default asks get_number_format with
the BCP-47 text of the locale.
get_compare_rules_by_locale
fn get_compare_rules_by_locale(self: &Self, locale: &Locale) -> Option<Rc<dyn super::ICompareRules>>
The culture-sensitive string comparison rules of locale, or None
when the provider has no rules for it (the parent locale is asked
next, and the built-in invariant rules are used last).
The default asks get_compare_rules with
the BCP-47 text of the locale.
get_text_info_by_locale
fn get_text_info_by_locale(self: &Self, locale: &Locale) -> Option<Rc<TextInfo>>
The text conventions (the list separator) of locale, or None when
the provider has no data for it (the parent locale is asked next).
The default asks get_text_info with the
BCP-47 text of the locale.
get_locales
fn get_locales(self: &Self, types: CultureTypes) -> Vec<Locale>
The locales of the cultures of the given types the provider has data
for, in the order they are listed in (the unknown locale und, the
invariant culture, is not among them). A provider that does not
enumerate its cultures lists none.
The default lists the locales of the names
get_culture_names lists; a name that is
not a BCP-47 language tag names no locale and is left out.
get_date_time_format
fn get_date_time_format(self: &Self, culture_name: &str) -> Option<Rc<DateTimeFormatInfo>>
The date and time conventions of the culture named exactly
culture_name (a language tag such as en-US; never empty), or
None when the provider has no data for it (the parent culture is
asked next).
Deprecated since 0.5.0. implement
get_date_time_format_by_locale, keyed by the locale of the culture
get_number_format
fn get_number_format(self: &Self, culture_name: &str) -> Option<Rc<NumberFormatInfo>>
The number conventions of the culture named exactly culture_name,
or None when the provider has no data for it (the parent culture is
asked next).
Deprecated since 0.5.0. implement
get_number_format_by_locale, keyed by the locale of the culture
get_compare_rules
fn get_compare_rules(self: &Self, culture_name: &str) -> Option<Rc<dyn super::ICompareRules>>
The culture-sensitive string comparison rules of the culture named
exactly culture_name, or None when the provider has no rules for
it (the parent culture is asked next, and the built-in invariant
rules are used last).
Deprecated since 0.5.0. implement
get_compare_rules_by_locale, keyed by the locale of the culture
get_text_info
fn get_text_info(self: &Self, culture_name: &str) -> Option<Rc<TextInfo>>
The text conventions (the list separator) of the culture named
exactly culture_name, or None when the provider has no data for
it (the parent culture is asked next).
Deprecated since 0.5.0. implement
get_text_info_by_locale, keyed by the locale of the culture
get_culture_names
fn get_culture_names(self: &Self, types: CultureTypes) -> Vec<String>
The names of the cultures of the given types the provider has data for, in the order they are listed in (the invariant culture, whose name is empty, is not among them). A provider that does not enumerate its cultures lists none.
Deprecated since 0.5.0. implement
get_locales, which lists the locales of the cultures
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.