Android字串資源#

用於翻譯應用的Android特定文件格式。

Android string resources are monolingual, the 單語的基底語言檔 is stored in a different location from the other files – res/values/strings.xml.

備註

當前不支持Android的 string-array 架構。為了解決這個問題,可以將字串數組分開:

<string-array name="several_strings">
    <item>First string</item>
    <item>Second string</item>
</string-array>

變為:

<string-array name="several_strings">
    <item>@string/several_strings_0</item>
    <item>@string/several_strings_1</item>
</string-array>
<string name="several_strings_0">First string</string>
<string name="several_strings_1">Second string</string>

指向 string 元素的 string-array 應存儲在不同文件中,並且不為翻譯所用。

這個腳本可以幫助預處理現有的 strings.xml 文件和翻譯:https://gist.github.com/paour/11291062

提示

To avoid translating some strings, these can be marked as non-translatable. This can be especially useful for string references:

<string name="foobar" translatable="false">@string/foo</string>

Weblate 設定組態#

典型的 Weblate 組件配置

文件掩碼

res/values-*/strings.xml

單語的基底語言檔

res/values/strings.xml

新翻譯的模板

Empty

檔案格式

Android字串資源