Skip to content

Commit 99ed01d

Browse files
authored
Drop language migration (#21913)
* Removed locale migration and added logging for when locale changed * Removed locale migration from main activity
1 parent d58529c commit 99ed01d

File tree

2 files changed

+3
-27
lines changed

2 files changed

+3
-27
lines changed

WordPress/src/main/java/org/wordpress/android/ui/main/WPMainActivity.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,6 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
369369
InstallationReferrerServiceStarter.startService(this, null);
370370
}
371371

372-
mPerAppLocaleManager.performMigrationIfNecessary();
373-
374372
if (FluxCUtils.isSignedInWPComOrHasWPOrgSite(mAccountStore, mSiteStore)
375373
&& !AppPrefs.getIsJetpackMigrationInProgress()) {
376374
NotificationType notificationType =

WordPress/src/main/java/org/wordpress/android/util/PerAppLocaleManager.kt

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@ package org.wordpress.android.util
22

33
import android.content.Context
44
import android.content.Intent
5-
import android.net.Uri
65
import android.os.Build
76
import android.provider.Settings
87
import androidx.annotation.RequiresApi
98
import androidx.appcompat.app.AppCompatDelegate
9+
import androidx.core.net.toUri
1010
import androidx.core.os.LocaleListCompat
1111
import org.wordpress.android.WordPress.Companion.getContext
1212
import org.wordpress.android.analytics.AnalyticsTracker
1313
import org.wordpress.android.fluxc.store.AccountStore
1414
import org.wordpress.android.fluxc.store.SiteStore
1515
import org.wordpress.android.fluxc.utils.AppLogWrapper
16-
import org.wordpress.android.ui.prefs.AppPrefsWrapper
1716
import org.wordpress.android.ui.reader.services.update.ReaderUpdateLogic.UpdateTask
1817
import org.wordpress.android.ui.reader.services.update.ReaderUpdateServiceStarter
1918
import org.wordpress.android.util.analytics.AnalyticsUtils
@@ -26,7 +25,6 @@ import javax.inject.Inject
2625
* https://developer.android.com/guide/topics/resources/app-languages
2726
*/
2827
class PerAppLocaleManager @Inject constructor(
29-
private val appPrefsWrapper: AppPrefsWrapper,
3028
private val appLogWrapper: AppLogWrapper,
3129
private val siteStore: SiteStore,
3230
private val accountStore: AccountStore,
@@ -49,22 +47,7 @@ class PerAppLocaleManager @Inject constructor(
4947
// on pre-Android 13 devices
5048
val appLocale = LocaleListCompat.forLanguageTags(languageCode.replace("_", "-"))
5149
AppCompatDelegate.setApplicationLocales(appLocale)
52-
}
53-
54-
/**
55-
* Previously the app locale was stored in SharedPreferences, so here we migrate to AndroidX per-app language prefs.
56-
* This was added in our Jan 2025 release and can be removed after a few subsequent releases.
57-
*/
58-
fun performMigrationIfNecessary() {
59-
val previousLanguage = appPrefsWrapper.getPrefString(OLD_LOCALE_PREF_KEY_STRING, "")
60-
if (previousLanguage?.isNotEmpty() == true) {
61-
appLogWrapper.d(
62-
AppLog.T.SETTINGS,
63-
"PerAppLocaleManager: performing migration to AndroidX per-app language prefs"
64-
)
65-
setCurrentLocaleByLanguageCode(previousLanguage)
66-
appPrefsWrapper.removePref(OLD_LOCALE_PREF_KEY_STRING)
67-
}
50+
appLogWrapper.d(AppLog.T.SETTINGS, "Language changed to $languageCode")
6851
}
6952

7053
/**
@@ -76,7 +59,7 @@ class PerAppLocaleManager @Inject constructor(
7659
fun openAppLanguageSettings(context: Context) {
7760
Intent().also { intent ->
7861
intent.setAction(Settings.ACTION_APP_LOCALE_SETTINGS)
79-
intent.setData(Uri.parse("package:" + context.packageName))
62+
intent.setData(("package:" + context.packageName).toUri())
8063
context.startActivity(intent)
8164
}
8265
}
@@ -116,9 +99,4 @@ class PerAppLocaleManager @Inject constructor(
11699
fun resetApplicationLocale() {
117100
AppCompatDelegate.setApplicationLocales(LocaleListCompat.getEmptyLocaleList())
118101
}
119-
120-
companion object {
121-
// Key previously used for saving the language selection to shared preferences
122-
private const val OLD_LOCALE_PREF_KEY_STRING: String = "language-pref"
123-
}
124102
}

0 commit comments

Comments
 (0)