应用程序包上处理应用程序内的动态语言更改

应用程序包上处理应用程序内的动态语言更改

本文介绍了在 android 应用程序包上处理应用程序内的动态语言更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了最新的 android 打包格式捆绑包并将我的应用程序发送到测试版渠道,捆绑包减少了约 60% 的应用程序大小,这真的很棒,

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)

现在的问题:AFAIK 基础 apk 在应用程序下载期间只会有用户语言的资源(如果在下载时,如果语言是 english.only string-en.xml 被下载)

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

请告诉我..

推荐答案

AFAIK 你可以通过使用 bundle 块来控制你希望你的 app bundle 支持哪些类型的配置 APK.

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

基于文档:

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

这篇关于在 android 应用程序包上处理应用程序内的动态语言更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 01:37