Function

GLibget_locale_variants

Declaration

gchar**
g_get_locale_variants (
  const gchar* locale
)

Description

Returns a list of derived variants of locale, which can be used to e.g. construct locale-dependent filenames or search paths. The returned list is sorted from most desirable to least desirable. 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 g_get_language_names().

Available since:2.28

Parameters

locale const gchar*
 

A locale identifier.

 The data is owned by the caller of the function.
 The string is a NUL terminated UTF-8 string.

Return value

Returns: An array of utf8
 

A newly allocated array of newly allocated strings with the locale variants. Free with g_strfreev().

 The caller of the function takes ownership of the data, and is responsible for freeing it.