Skip to main content

locale_variants

Function locale_variants 

Source
pub fn locale_variants(locale: &str) -> Vec<GString>
Expand description

Gets a list of derived variants of @locale.

This can be used to construct locale-dependent filenames or search paths, for example. The returned list is sorted from most desirable to least desirable.

On POSIX systems, @locale and the return values are in POSIX locale format. This function handles territory, charset and extra locale modifiers. See setlocale(3) for information about locales and their format.

@locale itself is guaranteed to be returned in the output.

For example, if @locale is fr_BE, then the returned list is fr_BE, fr. If @locale is en_GB.UTF-8@euro, then the returned list is en_GB.UTF-8@euro, en_GB.UTF-8, en_GB@euro, en_GB, en.UTF-8@euro, en.UTF-8, en@euro, en.

If you need the list of variants for the current locale, use language_names().

§locale

a locale identifier

§Returns

a non-empty array of the locale variants