getLocaleVariants

fnstring[] getLocaleVariants(string locale)

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-8euro, then the returned list is en_GB.UTF-8euro, en_GB.UTF-8, en_GBeuro, en_GB, en.UTF-8euro, en.UTF-8, eneuro, en.

If you need the list of variants for the current locale, use [glib.global.getLanguageNames].

Parameters

localea locale identifier

Returns

a newly

allocated array of newly allocated strings with the locale variants. Free with [glib.global.strfreev].