Search code examples
androidandroid-13

App does not appear in Per-app language settings


I'm currently trying to support per-app languages for my app. I followed the instructions:

  • I created locales_config.xml:
<?xml version="1.0" encoding="utf-8"?>
<locale_config xmlns:android="http://schemas.android.com/apk/res/android">
    <locale android:name="en-US"/>
    <locale android:name="fr"/>
</locale_config> 

which I added in AndroidManifest.xml:

android:localeConfig="@xml/locales_config"
  • In app/build.gradle, I added:
android {
    ...
    defaultConfig {
        ...
        resConfigs "en_US", "fr"
    }
}

My problem is that my app does not appear in Per-app language settings.
I tested it on both an emulator and a phone running stable Android 13.

Additional info:

com.android.tools.build:gradle:7.2.2
compileSdkVersion 33

If anyone got this working, I'd like to know if there's any other additional step I'm missing.

Edit:
It doesn't work either when replacing both en-US and en_US with en.


Solution

  • The root element in locales_config.xml must be <locale-config>, but in your xml I see <locale_config> (underscore should be a hypen).

    Update your locales_config.xml to the text below, and it will work:

    <?xml version="1.0" encoding="utf-8"?>
    <locale-config xmlns:android="http://schemas.android.com/apk/res/android">
        <locale android:name="en-US"/>
        <locale android:name="fr"/>
    </locale-config>