2016-07-26 56 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>