Search code examples
androidlocalizationapk

Handle dynamic language change within the app on android app bundle


I have used the latest android packing format bundle and shipped my app to beta channel,bundles reduced ~60% of app size which was really awesome ,

my app has support for english and arabic (can be switched within the app on fly)

now the problem : AFAIK the base apk will only have resources for the users language during app download (if at time of download,if the language was english.only string-en.xml gets downlaoded)

so how do i handle the situation where in user switch the language within the app ..

please let me know..


Solution

  • AFAIK you can do it by using the bundle block to control which types of configuration APKs you want your app bundle to support.

    Based on the documentation:

    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
            }
        }
    }