TechBuzzPro

Per-App Language Not Working on Android 12 or Older?

· 5 min read · Phones & Tablets

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Per-app language switching does not work with an application context on Android 12 and older because the feature itself was introduced in Android 13 (API level 33). On those older versions, there is no system-level per-app language API, so setting a locale through an application context has no effect. The only reliable way to change an app's language on pre-Android 13 devices is to handle it inside the app with a library such as AndroidX AppCompat, or to instruct users to change the whole system language. This guide explains why the API is missing, what to do instead, and how to test it without breaking your app.

What You'll Need

  • A test device or emulator running Android 12L (API 32) or lower, plus one running Android 13 (API 33) or higher for comparison.
  • Android Studio with the AndroidX AppCompat library added to your project dependencies.
  • Basic familiarity with Android resources, locales, and the Context vs Activity distinction.
  • A backup of your project before changing locale handling, since resource configuration changes can affect layouts and string lookups.

Step-by-Step

  1. Confirm the API level. Check Build.VERSION.SDK_INT at runtime. If it is below 33, the system per-app language API (LocaleManager and the per-app language settings screen) is not available. Any call to it will either be ignored or throw, depending on how you guard it.
  2. Stop relying on the application context for locale changes. On Android 13+, per-app languages are stored by the system and applied when the app's activities are created. On older versions, the application context does not carry a locale override, so wrapping it with a configuration context will not change strings shown by activities that were already created.
  3. Add AndroidX AppCompat if it is not already present. In your app-level build file, include the AppCompat dependency. AppCompat provides AppCompatDelegate.setApplicationLocales(), which backports per-app language behavior to older Android versions when you use AppCompat activities.
  4. Make every activity extend AppCompatActivity. The backport only applies to activities that inherit from AppCompat. If some screens use plain Activity or a different base class, those screens will keep the old language and look inconsistent.
  5. Call the locale setter from a user action, not from Application.onCreate. Trigger it when the user picks a language in your settings screen. Calling it too early, before the activity is attached, can cause the change to be lost or applied only after a restart.
  6. Persist the choice yourself on older versions. The AppCompat backport stores the selection, but if you support versions where the backport is unavailable, save the chosen language code in SharedPreferences and reapply it on startup before the first activity is shown.
  7. Recreate activities after the change. After setting the locale, call recreate() on the current activity so that strings, layouts, and formatted dates reload with the new locale. Without this, the screen may keep the old text until the user navigates away.
  8. Test on both sides of the API boundary. Run the same flow on an Android 12 emulator and an Android 13 emulator. On Android 13, the system settings screen for per-app languages should list your app. On Android 12, that screen will not exist, and only your in-app picker should change the language.
  9. Check resource qualifiers. Make sure your translated strings live in the correct values-xx folders. A missing translation falls back to the default language, which can look like the feature failed when it actually worked.
  10. Verify with a log or a visible string. Add a temporary log of resources.configuration.locales after recreation, or display a string that differs clearly between languages, so you can confirm the change took effect.

Common Mistakes

  • Assuming the per-app language API works on every Android version because it compiles. It compiles against the latest SDK but is a no-op or unavailable at runtime on older devices.
  • Calling the locale setter from the application context or from a background service. The change needs an activity context and a recreation to be visible.
  • Mixing AppCompat activities with plain activities, which produces a half-translated app.
  • Forgetting to add the translated resources, then blaming the API for the fallback language.
  • Setting the locale before the activity is created and expecting the first screen to update without a recreate.

Tips

  • Guard every call to the Android 13 per-app language API with a version check so older devices skip it cleanly.
  • Keep the in-app language picker visible on all versions, even when the system settings screen also offers the option, so users have one consistent place to change it.
  • Use a single helper class for locale changes so you do not duplicate the version check across screens.
  • Test with a language that changes word order, not just a language with similar grammar, to catch layout issues early.

Troubleshooting

If the language does not change on Android 12 or lower, first confirm the activity extends AppCompatActivity and that the locale setter is called from a user action. Next, check that the chosen language code matches an existing values-xx folder exactly. If only some screens change, look for activities that do not use the AppCompat base class. If the change applies but reverts after a restart, your saved preference is missing or is being overwritten at startup. If the app crashes when calling the newer API, add the version guard. If the system settings screen does not list your app on Android 13, verify that the app declares the locale configuration correctly in its manifest and that the device is actually running Android 13 or later.

Frequently Asked Questions

Why does per-app language not work on Android 12?

The feature was added in Android 13. Android 12 and older have no system-level per-app language setting, so the API is unavailable there.

Can I use an application context to change the language on older versions?

No. The application context does not apply a locale override to already-created activities. Use AppCompat's backport with AppCompat activities instead.

Does the AppCompat backport work on all older versions?

It works on versions supported by the AppCompat library, but only for activities that extend AppCompatActivity. Plain activities are not covered.

Why does the language change only after I restart the app?

The activity was not recreated after the locale change. Call recreate() on the current activity so resources reload with the new locale.

Do I still need an in-app language picker on Android 13?

It is optional there, because the system settings screen offers the option, but keeping your own picker gives users a consistent place to change the language on every version.

Why do some strings stay in the old language?

Those strings likely come from an activity that does not use the AppCompat base class, or the translation for that language is missing and the app is falling back to the default.