Skip to content

Instantly share code, notes, and snippets.

@stdStudent
stdStudent / CurrentlyDisplayedLocale.kt
Last active September 7, 2024 04:27
Android, Locale utilities: get a currently displayed locale at a device's system level, validate a locale or a language tag
/**
* Licensed under the BSD-3-Clause-Clear license.
* The license text in enclosed in the comment section.
*/
/**
* The idea is to use the hidden SYSTEM_LOCALES ("system_locales") setting
* to get the currently displayed locale. Although the documentation says
* that one must use `LocaleList.getDefault` instead, I couldn't really