Open
Description
Migrated from chaquo/chaquopy#1150:
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, probably because it supports changing the locale within the lifetime of a single process. Instead, it provides an Android-specific API:
context.getResources().getConfiguration().getLocales().get(0)
This will return a string in the form en_US
, which can be passed to locale.setlocale
.
The difficult part is getting a reference to the context
object. For details, see #90371 (comment).
Metadata
Metadata
Assignees
Projects
Status
Todo