gpt4 book ai didi

android - 应用程序中未显示多语言字符串

转载 作者:行者123 更新时间:2023-11-29 00:52:50 32 4
gpt4 key购买 nike

  • 我在 gradle 中有这个设置
  • 我已经上传了 .aab playstore。
  • 该应用程序是多语言的,即英语Bahasa

android {
// When building Android App Bundles, the splits block is ignored.
splits {...}

// Instead, use the bundle block to control which types of configuration APKs
// you want your app bundle to support.
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 = true
}
density {
// This property is set to true by default.
enableSplit = true
}
abi {
// This property is set to true by default.
enableSplit = true
}
}
}

问题:当我从 play-store 下载应用程序后,我只能在应用程序中看到 English 字符串,而 Bahasa 语言不会出现切换语言

问题:是否指定 language-split = true 导致此问题

最佳答案

你所做的一切都很好,似乎当你的设备不包含你从应用程序中选择的指定语言时(即来自应用程序的语言设置)播放核心库 无法为您获取该资源,因为您的设备不支持该区域设置。

因此,解决方案是手动请求它为您下载该资源。

您可以通过向 SplitsInstallManager 发出请求来做到这一点。

创建新的 SplitsInstallRequest 并将其提供给 SplitsInstallManager,以便它为您提供该资源。

查看下面的代码 fragment :

// Creates a request to download and install additional language resources.
val request = SplitInstallRequest.newBuilder()
// Uses the addLanguage() method to include French language resources in the request.
// Note that country codes are ignored. That is, if your app
// includes resources for “fr-FR” and “fr-CA”, resources for both
// country codes are downloaded when requesting resources for "fr".
.addLanguage(Locale.forLanguageTag("your language code here"))
.build()

// Submits the request to install the additional language resources.
splitInstallManager.startInstall(request)

Refer here 了解更多详情。

关于android - 应用程序中未显示多语言字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57781961/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com