Skip to content

Conversation

diogob003
Copy link
Contributor

It needs more testing. Feel free to continue the work if you want to.

@diogob003 diogob003 marked this pull request as draft September 26, 2025 22:28
Copy link
Collaborator

@fire-light42 fire-light42 left a 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.

Comment on lines 227 to 231
fun Context.updateLocale() {
val settingsManager = PreferenceManager.getDefaultSharedPreferences(this)
val localeCode = settingsManager.getString(getString(R.string.locale_key), null)
setLocale(this, localeCode)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)
}

Copy link
Collaborator

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.

@SittingDuck999
Copy link

@fire-light42 sorry for the ping but will this be merged anytime soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants