【发布时间】:2021-01-10 10:43:53
【问题描述】:
在我的 strings.xml 中,我有几个字符串数组。我想以与翻译其他字符串相同的方式翻译它们 - 使用 Android Studio 中的翻译编辑器。但是,我在翻译编辑器中看不到字符串数组。有什么办法可以将翻译编辑器用于字符串数组和字符串?翻译字符串数组的最佳做法是什么?
【问题讨论】:
标签: android string language-translation
在我的 strings.xml 中,我有几个字符串数组。我想以与翻译其他字符串相同的方式翻译它们 - 使用 Android Studio 中的翻译编辑器。但是,我在翻译编辑器中看不到字符串数组。有什么办法可以将翻译编辑器用于字符串数组和字符串?翻译字符串数组的最佳做法是什么?
【问题讨论】:
标签: android string language-translation
让数组使用strings.xml中的字符串,如下所示:
在arrays.xml中:
<string-array name="countries">
<item>@string/contry_option_0</item>
<item>@string/contry_option_1</item>
</string-array>
在strings.xml中:
<string name="country_option_0">Japan</string>
<string name="country_option_1">Thailand</string>
完成后,您可以在翻译编辑器中看到键 contry_option_0 和 contry_option_1。
【讨论】: