support Android 13 per-app languages (#2829)
* support Android 13 per-app languages * fix tests * fix language ids in locales_config.xml * fix language setting default in ComposeActivity
This commit is contained in:
parent
9f7cd2fa32
commit
c96a81571c
11 changed files with 165 additions and 89 deletions
|
|
@ -47,6 +47,7 @@ import androidx.annotation.ColorInt
|
|||
import androidx.annotation.StringRes
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.FileProvider
|
||||
|
|
@ -561,7 +562,7 @@ class ComposeActivity :
|
|||
private fun getInitialLanguage(language: String? = null): String {
|
||||
return if (language.isNullOrEmpty()) {
|
||||
// Setting the application ui preference sets the default locale
|
||||
Locale.getDefault().language
|
||||
AppCompatDelegate.getApplicationLocales()[0]?.language ?: Locale.getDefault().language
|
||||
} else {
|
||||
language
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue