Skip to content

Commit

Permalink
Merge branch 'feature/per-app-language-prefs' into issue/remove-local…
Browse files Browse the repository at this point in the history
…e-aware-activity
  • Loading branch information
nbradbury authored Dec 13, 2024
2 parents 38b3baf + 81c2235 commit 857564b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
import org.wordpress.android.util.AppThemeUtils;
import org.wordpress.android.util.BuildConfigWrapper;
import org.wordpress.android.util.JetpackBrandingUtils;
import org.wordpress.android.util.LocaleProvider;
import org.wordpress.android.util.NetworkUtils;
import org.wordpress.android.util.PerAppLocaleManager;
import org.wordpress.android.util.ToastUtils;
Expand Down Expand Up @@ -103,7 +102,6 @@ public class AppSettingsFragment extends PreferenceFragment
@Inject FeatureAnnouncementProvider mFeatureAnnouncementProvider;
@Inject BuildConfigWrapper mBuildConfigWrapper;
@Inject JetpackBrandingUtils mJetpackBrandingUtils;
@Inject LocaleProvider mLocaleProvider;
@Inject DeepLinkOpenWebLinksWithJetpackHelper mOpenWebLinksWithJetpackHelper;
@Inject UiHelpers mUiHelpers;
@Inject JetpackFeatureRemovalPhaseHelper mJetpackFeatureRemovalPhaseHelper;
Expand Down Expand Up @@ -599,7 +597,7 @@ private boolean handleFeatureAnnouncementClick() {
}

private boolean handleAppLocalePickerClick() {
// if the device is on API 33+, take the user to the system app settings to change the language
// if the device is on API 33+, take the user to the system app settings to change the language
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
mPerAppLocaleManager.openAppLanguageSettings(getContext());
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class PerAppLocaleManager @Inject constructor(

fun getCurrentLocaleDisplayName(): String = getCurrentLocale().displayName

fun getCurrentLocaleLanguageCode(): String = getCurrentLocale().language
private fun getCurrentLocaleLanguageCode(): String = getCurrentLocale().language

/**
* Important: this should only be called after Activity.onCreate()
Expand Down Expand Up @@ -134,7 +134,7 @@ class PerAppLocaleManager @Inject constructor(
}

// Only update if the language is different
if (languageCode.equals(getCurrentLocaleLanguageCode()).not()) {
if (languageCode != getCurrentLocaleLanguageCode()) {
setCurrentLocaleByLanguageCode(languageCode)
}

Expand Down

0 comments on commit 857564b

Please sign in to comment.