tidev / titanium-sdk

🚀 Native iOS and Android Apps with JavaScript
https://titaniumsdk.com/
Other
2.76k stars 1.21k forks source link

feat(android): getter/setter for applicationLocales in Android 12 and up #14013

Closed AbdullahFaqeir closed 2 months ago

AbdullahFaqeir commented 8 months ago

Description:

This PR was raised from an issue appeared on android level 33 and later which caused Ti.Locale.setLanguage() not to work properly, which caused random pages not to be translated unless you recall Ti.Locale.setLanguage() on each page.

See here

Replacing PR #14008

edited by Michael: for a test code check https://github.com/tidev/titanium-sdk/pull/14008#issuecomment-2009179503

AbdullahFaqeir commented 2 months ago

Can you revert the changes to the comments in the LocaleModule, please. And the text.startsWith... change. Don't think that is needed for the applicationLocale.

Please keep the indent level in the doc file. @m1ga Should I go back to this?

AbdullahFaqeir commented 2 months ago

@m1ga @AbdullahFaqeir can we check on this?

m1ga commented 2 months ago

Documentation: Can you change the indent level of the readme file back to the old amount of spaces so it will be inline with the other files and doesn't have that many changes. And it would be good to say it is reading/setting the "Per-app language" instead of "UI language". Google calls it: https://developer.android.com/guide/topics/resources/app-languages Also add "returns an empty array if no per-app language is set yet". So people won't get confused why it is not returning anything (e.g. a default lang).

AbdullahFaqeir commented 2 months ago

Documentation: Can you change the indent level of the readme file back to the old amount of spaces so it will be inline with the other files and doesn't have that many changes. And it would be good to say it is reading/setting the "Per-app language" instead of "UI language". Google calls it: https://developer.android.com/guide/topics/resources/app-languages Also add "returns an empty array if no per-app language is set yet". So people won't get confused why it is not returning anything (e.g. a default lang).

@m1ga of course, I'll do it ASAP

AbdullahFaqeir commented 2 months ago

@m1ga @hansemannn I believe this one is ready/

hansemannn commented 2 months ago

There seem to be many changes which are not related to this PR, e.g. docs indentation and iOS xcode settings. Please split these up into separate PR's, so this one remains slim. Thank you!

m1ga commented 2 months ago

And please add the API 33 check again https://developer.android.com/reference/android/app/LocaleManager#setApplicationLocales(android.os.LocaleList) was "Added in API level 33" and Ti still supports lower SDKs