当我们将文件提供给翻译人员时,我们发现评论消息非常有用。对于Android应用,有没有办法在 strings.xml 中为翻译添加评论消息?
// In the strings.xml
<string name="hello___">Hello %1$s</string>
在iOS上,我们可以这样做:
// In the code, when we export the translation file to xliff,
// The comments in `NSLocalizedString` will be collected and inserted into the xliff file
NSString *greetingMessage = NSLocalizedString(@"hello__",
@"A simple greeting messsage, %@ will be replaced by user's name");
// In the Localizable.strings file
"hello__"="hello %@";
在Windows上,我们可以这样做:
// In the Resources.resw file:
<data name="hello__" xml:space="preserve">
<value>Hello {0}</value>
<comment>{0} will be replace by user's name</comment>
</data>
答案 0 :(得分:1)
对于Android应用,有没有办法在strings.xml中为翻译添加评论消息?
之后你还需要保持有效的XML:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- my comment for the translator here... -->
<string name="string_name">text_string</string>
</resources>