如何将来自 Developer Console 的翻译放入 android 应用程序的资源文件中?
How to put translations from Developer Console in an android app's resource file?
我从 Google Play Developer Console 支付了翻译服务费用,所有语言都已成功翻译。我成功地将应用的商品详情描述翻译成 9 种语言。
但是如何翻译 strings.xml
中的所有字符串呢?我下载了一个包含所有已翻译字符串的文件,但我该如何处理它以及将它放在哪里?
您需要为 strings.xml 创建包含不同语言的单独文件夹。您可以 see/read How to Create Alternative Resources 指南中的此内容:
res/values/strings.xml Contains English text for all the strings that the application uses, including text for a string named title.
res/values-fr/strings.xml Contain French text for all the strings, including title.
- res/values-ja/strings.xml Contain Japanese text for all the strings except title.
If your Java code refers to R.string.title, here is what will happen
at runtime:
If the device is set to any language other than French, Android will
load title from the res/values/strings.xml file. If the device is set
to French, Android will load title from the res/values-fr/strings.xml
file.
检查此 Multilingual app tutorial 以获得实践经验。
我从 Google Play Developer Console 支付了翻译服务费用,所有语言都已成功翻译。我成功地将应用的商品详情描述翻译成 9 种语言。
但是如何翻译 strings.xml
中的所有字符串呢?我下载了一个包含所有已翻译字符串的文件,但我该如何处理它以及将它放在哪里?
您需要为 strings.xml 创建包含不同语言的单独文件夹。您可以 see/read How to Create Alternative Resources 指南中的此内容:
res/values/strings.xml Contains English text for all the strings that the application uses, including text for a string named title.
res/values-fr/strings.xml Contain French text for all the strings, including title.
- res/values-ja/strings.xml Contain Japanese text for all the strings except title.
If your Java code refers to R.string.title, here is what will happen at runtime:
If the device is set to any language other than French, Android will load title from the res/values/strings.xml file. If the device is set to French, Android will load title from the res/values-fr/strings.xml file.
检查此 Multilingual app tutorial 以获得实践经验。