简体   繁体   English

Android 应用程序包不支持动态语言更改

[英]Android app bundle not supporting dynamic language change

My app supports multi languages and which can change dynamically within app and that is working fine with APK previously.我的应用程序支持多种语言,可以在应用程序内动态更改,并且以前与 APK 一起工作正常。 But When I adapt AAB instead of APK then I am facing this issue.但是当我采用 AAB 而不是 APK 时,我就会面临这个问题。 Now my app not change language within app but if I will change language of my device then It will change language of my app as well.现在我的应用程序不会更改应用程序内的语言,但如果我要更改设备的语言,那么它也会更改我的应用程序的语言。 Is there any solution for the above issue instead of using是否有解决上述问题的方法而不是使用

bundle {
        language {
            enableSplit = false
        }
    }

Download additional language resources下载其他语言资源

With app bundles, devices download only the code and resources they require to run your app.使用应用程序包,设备仅下载运行您的应用程序所需的代码和资源。 So, for language resources, a user's device downloads only your app's language resources that match the one or more languages currently selected in the device's settings.因此,对于语言资源,用户的设备只会下载与设备设置中当前选择的一种或多种语言相匹配的应用语言资源。

If you want your app to have access to additional language resources—for example, to implement an in-app language picker, you can use the Play Core Library to download them on demand.如果您希望您的应用能够访问其他语言资源——例如,要实现应用内语言选择器,您可以使用 Play 核心库按需下载它们。

1. The main way, please see this link: 1.主要方式请看这个链接:

https://developer.android.com/guide/playcore/feature-delivery/on-demand#lang_resources https://developer.android.com/guide/playcore/feature-delivery/on-demand#lang_resources

2. The latest Android App Bundle updates including the additional languages API 2.最新的Android App Bundle更新包括附加语言API

Get a list of installed languages 获取已安装语言的列表

3. This way will increase the size of the app. 3.这种方式会增加应用程序的大小。

android {
    bundle {
        language {
          
            enableSplit = false
        }
    }
}

4. Use APKs if you want to have an in app language picker. 4.如果您想拥有应用内语言选择器,请使用 APK。

add this in your app level gradle inside of defaultConfig, with languages you want to include in your application将此添加到您的应用程序级别 gradle 中的 defaultConfig 中,并使用您希望在应用程序中包含的语言

resConfigs "en", "fr", "ru"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM