Don't try to migrate "system" app language
This commit is contained in:
parent
a9e032c0c4
commit
cc5298a430
1 changed files with 11 additions and 8 deletions
|
|
@ -127,17 +127,20 @@ public class App extends Application {
|
||||||
YoutubeStreamExtractor.setPoTokenProvider(PoTokenProviderImpl.INSTANCE);
|
YoutubeStreamExtractor.setPoTokenProvider(PoTokenProviderImpl.INSTANCE);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= 33) {
|
if (Build.VERSION.SDK_INT >= 33) {
|
||||||
|
final String appLanguageDefaultValue = getString(R.string.default_localization_key);
|
||||||
final String appLanguageKey = getString(R.string.app_language_key);
|
final String appLanguageKey = getString(R.string.app_language_key);
|
||||||
if (prefs.contains(appLanguageKey)) {
|
final String appLanguageCurrentValue = prefs.getString(appLanguageKey, null);
|
||||||
|
if (appLanguageCurrentValue != null) {
|
||||||
// Migrate to Android per-app language settings
|
// Migrate to Android per-app language settings
|
||||||
final String languageCode = prefs.getString(appLanguageKey, null);
|
|
||||||
prefs.edit().remove(appLanguageKey).apply();
|
prefs.edit().remove(appLanguageKey).apply();
|
||||||
try {
|
if (!appLanguageCurrentValue.equals(appLanguageDefaultValue)) {
|
||||||
AppCompatDelegate.setApplicationLocales(
|
try {
|
||||||
LocaleListCompat.forLanguageTags(languageCode)
|
AppCompatDelegate.setApplicationLocales(
|
||||||
);
|
LocaleListCompat.forLanguageTags(appLanguageCurrentValue)
|
||||||
} catch (final RuntimeException e) {
|
);
|
||||||
Log.e(TAG, "Error migrating to Android 13+ per-app language settings");
|
} catch (final RuntimeException e) {
|
||||||
|
Log.e(TAG, "Error migrating to Android 13+ per-app language settings");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue