# ICultureDataProvider

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/utilities/trait-iculturedataprovider/

**trait** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
trait ICultureDataProvider: 'static
```

Supplies the conventions of cultures by locale. Register an
implementation with the locator:

```ignore
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`).

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/i_culture_data_provider.rs#L33)

## Members

- [`get_date_time_format_by_locale`](#function-get_date_time_format_by_locale)
- [`get_number_format_by_locale`](#function-get_number_format_by_locale)
- [`get_compare_rules_by_locale`](#function-get_compare_rules_by_locale)
- [`get_text_info_by_locale`](#function-get_text_info_by_locale)
- [`get_locales`](#function-get_locales)
- [`get_date_time_format`](#function-get_date_time_format)
- [`get_number_format`](#function-get_number_format)
- [`get_compare_rules`](#function-get_compare_rules)
- [`get_text_info`](#function-get_text_info)
- [`get_culture_names`](#function-get_culture_names)

<a id="function-get_date_time_format_by_locale"></a>

### get_date_time_format_by_locale

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/i_culture_data_provider.rs#L40)

<a id="function-get_number_format_by_locale"></a>

### get_number_format_by_locale

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/i_culture_data_provider.rs#L51)

<a id="function-get_compare_rules_by_locale"></a>

### get_compare_rules_by_locale

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/i_culture_data_provider.rs#L63)

<a id="function-get_text_info_by_locale"></a>

### get_text_info_by_locale

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/i_culture_data_provider.rs#L74)

<a id="function-get_locales"></a>

### get_locales

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/i_culture_data_provider.rs#L88)

<a id="function-get_date_time_format"></a>

### get_date_time_format

```rust
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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/i_culture_data_provider.rs#L97)

<a id="function-get_number_format"></a>

### get_number_format

```rust
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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/i_culture_data_provider.rs#L106)

<a id="function-get_compare_rules"></a>

### get_compare_rules

```rust
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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/i_culture_data_provider.rs#L116)

<a id="function-get_text_info"></a>

### get_text_info

```rust
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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/i_culture_data_provider.rs#L125)

<a id="function-get_culture_names"></a>

### get_culture_names

```rust
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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/i_culture_data_provider.rs#L135)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
