-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Open
Labels
OS-androidstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
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).
hyuri and aisk
Metadata
Metadata
Assignees
Labels
OS-androidstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Projects
Status
Todo