-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Per app language preferences #17158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Per app language preferences #17158
Conversation
Step1: Create locales_config.xml file for supported languages
Step 2: Update manifest with localeConfig line
Step 3: Specify supported languages using resConfigs in build.gradle
Step 4: Update compileSdkVersion in top level build.gradle to support localeConfig
Fix for ClassNotFoundException by updating path
Update androidx appcompat to 1.6.0-rc01 for backward compatibility
Updates for API changes with upgrade to appcompat 1.6.0-rc01
This comment was marked as off-topic.
This comment was marked as off-topic.
You can test the Jetpack changes on this Pull Request by downloading an installable build (jetpack-installable-build-pr17158-5fa233c.apk), or scanning this QR code: |
You can test the WordPress changes on this Pull Request by downloading an installable build (wordpress-installable-build-pr17158-5fa233c.apk), or scanning this QR code: |
// Limit string resources to Mag16 only for Jetpack | ||
// Note: this only affects included _locales_; variants for `values-night`, `values-land` and other configs are _still_ preserved in Jetpack and not filtered by this. | ||
resourceConfigurations = ["ar", "de", "es", "fr", "he", "id", "it", "ja", "ko", "nl", "pt-rBR", "ru", "sv", "tr", "zh-rCN", "zh-rTW"] | ||
resConfigs "ar", "de", "es", "fr", "he", "id", "it", "ja", "ko", "nl", "pt-rBR", "ru", "sv", "tr", "zh-rCN", "zh-rTW" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to what I read in the documentation and what Oguz told me recently [internal ref: pxLjZ-7b9-p2#comment-19303], resConfig
is deprecated in favor of resourceConfigurations
now (though sadly not all the guides in the Android docs have been updated)
Our current release scripts also checks the resourceConfigurations
field (and not the resConfig
deprecated one) at release time to ensure our setup is consistent between here in build.gradle
and in what locales are configured to be downloaded from GlotPress in our Fastlane scripts, so it's another reason to use resourceConfigurations
here and not resConfigs
.
implementation 'androidx.exifinterface:exifinterface:1.0.0' | ||
implementation 'androidx.media:media:1.0.1' | ||
implementation 'androidx.appcompat:appcompat:1.1.0' | ||
implementation 'androidx.appcompat:appcompat:1.6.0-rc01' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cc @ParaskP7 I know you had in your backlog to look into updating AppCompat at some point (in part exactly for this use case of supporting per-app locale backwards compatibility); seems @ravishanker beat you to it, which means (assuming no other changes due to this AppCompat update in other parts/topics in the app are needed) you might be able to cross an item off your list once this lands?
<locale android:name="zh-TW"/> <!-- Chinese (Traditional) --> | ||
<!-- <locale android:name="zu"/> <!– Zulu –>--> | ||
</locale-config> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll want to auto generate this file using our release-toolkit when we download the list of locales from GlotPress.
Basically replicate here what we already do for available_languages.xml
(which we'll in turn be able to stop generating when we'll get rid of our custom in-app switcher once we fully migrate to this new Android 12 built-in per-app switcher)
Otherwise this list can easily go out of sync when we'll revisit the list of locales we include in the app [internal ref: pdnsEh-ev-p2]
👋 @ravishanker ! This is so cool that you are trying this Per-app language preferences feature! 🌟
Btw, in your description, did you mean Android 13 (API 33) maybe? 🤔 |
There's a new PR for this work |
This PR adds Per-app Language Preferences introduced in Android 12 (API 31) level.
Fixes #
App Lanaguages > App
device-2022-09-16-114901.mp4
App > Language
device-2022-09-16-114935.mp4
To test:
Test 1:
Test 2:
NOTE:
Regression Notes
Potential unintended areas of impact
What I did to test those areas of impact (or what existing automated tests I relied on)
What automated tests I added (or what prevented me from doing so)
PR submission checklist:
RELEASE-NOTES.txt
if necessary.