2016-07-26 58 views
0

当我们将文件提供给翻译人员时,我们发现评论消息非常有用。对于Android应用程序,有没有办法在strings.xml中为翻译器添加注释消息?如何在android翻译文件中添加注释

// 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> 
+2

试< - 在这里评论! - > – Bill

+0

@quidproquo感谢您的评论!它的工作原理! –

回答

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>