gpt4 book ai didi

ios - iOS 如何在 Cordova/Phonegap build 中进行本地化?

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:58:06 25 4
gpt4 key购买 nike

我正在尝试以不同的语言显示我的应用程序名称。

  1. 英语
  2. 中文(简体)
  3. 中文(繁体)

我正在使用 phonegap build 来构建应用程序,因此无法使用 xcode。

因此,我在 res 文件夹中手动创建了 3 个包含相应 InfoPlist.strings 文件的文件夹,例如:

  • zh.lproj/InfoPlist.strings
  • zh.lproj/InfoPlist.strings
  • zh-hant.lproj/InfoPlist.strings

zh-hant.lproj 文件夹中的 InfoPlist.strings 文件示例:

enter image description here

我的 config.xml 将这些行复制到相应的文件夹并分别使用它。

        <resource-file src="res/zh-hant.lproj" target="zh-hant.lproj" />
<resource-file src="res/zh.lproj" target="zh.lproj" />
<resource-file src="res/en.lproj" target="en.lproj" />

<!-- copy localization file -->

<resource-file src="res/zh-hant.lproj/InfoPlist.strings" target="zh-hant.lproj/InfoPlist.strings" />
<resource-file src="res/zh.lproj/InfoPlist.strings" target="zh.lproj/InfoPlist.strings" />
<resource-file src="res/en.lproj/InfoPlist.strings" target="en.lproj/InfoPlist.strings" />

<config-file platform="ios" parent="LSHasLocalizedDisplayName" mode="replace">
<true />
</config-file>

<edit-config target="CFBundleLocalizations" file="*-Info.plist" mode="overwrite">
<array>
<string>en</string> <!-- english -->
<string>zh</string> <!-- chinese (simplified) -->
<string>zh-hant</string> <!-- chinese (traditional) -->
</array>
</edit-config>

问题是,当我在 iPhone 上安装该应用程序时,翻译不起作用。我的当前语言设置为英语,我得到了英文名字。

当我将语言更改为中文时,它没有反应(翻译不工作,即仍然是英文)。

我该如何解决这个问题?有什么我想念的吗?

最佳答案

如果您希望调试本地化,您需要编辑您的方案,如 here 所述.

关于ios - iOS 如何在 Cordova/Phonegap build 中进行本地化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57726932/

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