File tree Expand file tree Collapse file tree
app/src/main/java/org/schabi/newpipe Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,17 +127,20 @@ public void onCreate() {
127127 YoutubeStreamExtractor .setPoTokenProvider (PoTokenProviderImpl .INSTANCE );
128128
129129 if (Build .VERSION .SDK_INT >= 33 ) {
130+ final String appLanguageDefaultValue = getString (R .string .default_localization_key );
130131 final String appLanguageKey = getString (R .string .app_language_key );
131- if (prefs .contains (appLanguageKey )) {
132+ final String appLanguageCurrentValue = prefs .getString (appLanguageKey , null );
133+ if (appLanguageCurrentValue != null ) {
132134 // Migrate to Android per-app language settings
133- final String languageCode = prefs .getString (appLanguageKey , null );
134135 prefs .edit ().remove (appLanguageKey ).apply ();
135- try {
136- AppCompatDelegate .setApplicationLocales (
137- LocaleListCompat .forLanguageTags (languageCode )
138- );
139- } catch (final RuntimeException e ) {
140- Log .e (TAG , "Error migrating to Android 13+ per-app language settings" );
136+ if (!appLanguageCurrentValue .equals (appLanguageDefaultValue )) {
137+ try {
138+ AppCompatDelegate .setApplicationLocales (
139+ LocaleListCompat .forLanguageTags (appLanguageCurrentValue )
140+ );
141+ } catch (final RuntimeException e ) {
142+ Log .e (TAG , "Error migrating to Android 13+ per-app language settings" );
143+ }
141144 }
142145 }
143146 }
You can’t perform that action at this time.
0 commit comments