From beeware/toga#2562:
Hello, how can I recognize the current language with locale.getlocale()?
When i try it on android, it only returns ('en_US', 'UTF-8'), even if default language was set to an other language.
I don't think Android sets any of the standard LC_... environment variables, but we can get this information from the Android API:
# In a Toga app, the equivalent of `context` is `app._impl.native`,
# where `app` is your `toga.App` object.
str(context.getResources().getConfiguration().getLocales().get(0))
This will return a string in the form en_US, which can be passed to locale.setlocale.
From beeware/toga#2562:
I don't think Android sets any of the standard
LC_...environment variables, but we can get this information from the Android API:This will return a string in the form
en_US, which can be passed tolocale.setlocale.