Android App Bundle with in-app locale change

Solution 1:

Edit:

The PlayCore API now supports downloading the strings for another language on-demand: https://developer.android.com/guide/playcore/feature-delivery/on-demand#lang_resources

Alternative solution (discouraged):

You can disable the splitting by language by adding the following configuration in your build.gradle

android {
    bundle {
        language {
            // Specifies that the app bundle should not support
            // configuration APKs for language resources. These
            // resources are instead packaged with each base and
            // dynamic feature APK.
            enableSplit = false
        }
    }
}

This latter solution will increase the size of the app.

Solution 2:

This is not possible with app bundles: Google Play only downloads resources when the device's selected languages change.

You'll have to use APKs if you want to have an in app language picker.

Solution 3:

Details of downloading the language on demand can be found here

https://android-developers.googleblog.com/2019/03/the-latest-android-app-bundle-updates.html

In your app’s build.gradle file:

dependencies {
    // This dependency is downloaded from the Google’s Maven repository.
    // So, make sure you also include that repository in your project's build.gradle file.
    implementation 'com.google.android.play:core:1.10.0'

    // For Kotlin users also add the Kotlin extensions library for Play Core:
    implementation 'com.google.android.play:core-ktx:1.8.1'
    ...
}

Get a list of installed languages

val splitInstallManager = SplitInstallManagerFactory.create(context)
val langs: Set<String> = splitInstallManager.installedLanguages

Requesting additional languages

val installRequestBuilder = SplitInstallRequest.newBuilder()
installRequestBuilder.addLanguage(Locale.forLanguageTag("pl"))
splitInstallManager.startInstall(installRequestBuilder.build())

Check above link for full details