# CultureInfoIetfLanguageTagConverter

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/data/struct-cultureinfoietflanguagetagconverter/

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

```rust
struct CultureInfoIetfLanguageTagConverter
```

Converts the IETF language tag of a culture (`de-DE`, `ar-SA`) to the
culture: the converter of the `ConverterCulture` property of the
bindings in markup.

The original is a type converter that the property names with an
attribute. Here a type states its conversion from text in its markup
metadata (`parse:`), so the metadata of `CultureInfo` names
`convert_from`, and every property of that type,
the converter culture of the bindings among them, takes a language tag.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/culture_info_ietf_language_tag_converter.rs#L15)

## Members

- [`can_convert_from`](#function-can_convert_from)
- [`convert_from`](#function-convert_from)
- [`convert_to_locale`](#function-convert_to_locale)

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

### can_convert_from

```rust
fn can_convert_from(source_type: ValueType) -> bool
```

Whether the converter converts from the type: only from text.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/culture_info_ietf_language_tag_converter.rs#L19)

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

### convert_from

```rust
fn convert_from(culture_name: &str) -> Result<CultureInfo, FormatError>
```

The culture of an IETF language tag
(`CultureInfo.GetCultureInfoByIetfLanguageTag`): the tag is parsed into
a `Locale` and the culture is the culture of the locale
(`CultureInfo::from_locale`), so the case of its subtags is
normalized (`ar-sa` is `ar-SA`); the empty tag is the invariant
culture. A text that is not a BCP-47 language tag is refused with the
error of the reference: the old names `zh-CHT` and `zh-CHS`, the
traditional sort of Spanish `es-ES_tradnl`, a private name such as
`x-private`, a text with `_` as separator (`en_US`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/culture_info_ietf_language_tag_converter.rs#L32)

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

### convert_to_locale

```rust
fn convert_to_locale(culture_name: &str) -> Result<Locale, FormatError>
```

The locale of an IETF language tag: the locale the tag is parsed into,
the unknown locale `und` for the empty tag (the invariant culture), or
the error of `convert_from` for a text that is
not a BCP-47 language tag.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ErasedDestructor`
- `IntoEither`

## Availability

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