fn locale_from_environment() -> Locale
Expand description

Gets the user’s preferred locale from the environment and translates it to a Locale with LanguageRange fallbacks.

The Locale::current() call only contemplates a single language, but glib is smarter, and g_get_langauge_names() can provide fallbacks, for example, when LC_MESSAGES=“en_US.UTF-8:de” (USA English and German). This function converts the output of g_get_language_names() into a Locale with appropriate fallbacks.