-
Notifications
You must be signed in to change notification settings - Fork 716
Feature: support android 13+ language per-app #1934
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
base: master
Are you sure you want to change the base?
Conversation
fire-light42
left a comment
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.
Good pull request.
We just need to figure out how to handle language regions such as English (New Zealand) which gets the language code en-NZ.
| fun Context.updateLocale() { | ||
| val settingsManager = PreferenceManager.getDefaultSharedPreferences(this) | ||
| val localeCode = settingsManager.getString(getString(R.string.locale_key), null) | ||
| setLocale(this, localeCode) | ||
| } |
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.
| fun Context.updateLocale() { | |
| val settingsManager = PreferenceManager.getDefaultSharedPreferences(this) | |
| val settingsLocale = settingsManager.getString(getString(R.string.locale_key), null) | |
| val localeCode = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) | |
| AppCompatDelegate.getApplicationLocales().get(0)?.toLanguageTag() ?: settingsLocale | |
| else | |
| settingsLocale | |
| setLocale(this, localeCode) | |
| } |
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.
I am thinking we use getApplicationLocales as the primary source of truth as to remove inconsistencies when setting it in android settings first and then app settings.
|
@fire-light42 sorry for the ping but will this be merged anytime soon? |
Looks like there is still some work to do before this can be merged. |
It needs more testing. Feel free to continue the work if you want to.