CultureInfoIetfLanguageTagConverter
struct · ferroui-base · v0.5.0
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.
Members
can_convert_from
fn can_convert_from(source_type: ValueType) -> bool
Whether the converter converts from the type: only from text.
convert_from
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).
convert_to_locale
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.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyErasedDestructorIntoEither
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.