问题描述
什么是*comment
参数:
NSString *NSLocalizedString(NSString *key, NSString *comment)
如果我这样做:
NSLocalizedString(@"Hello_World_Key", @"Hello World")
,并且有两个版本的Localizable.strings(英语和西班牙语),每个都需要输入:
and have two versions of a Localizable.strings (English and Spanish), does each need the entry:
English.lproj/Localization.strings: @"Hello_World_Key" = @"Hello World";
Spanish.lproj/Localization.strings: @"Hello_World_Key" = @"Hola Mundo";
英语不是多余的吗?
推荐答案
注释字符串被应用程序忽略.它用于翻译者的利益,可在您的应用程序中找到的键的上下文用法中添加含义.
The comment string is ignored by the application. It is used for a translator's benefit, to add meaning to the contextual usage of the key where it is found in your application.
例如,Hello_World_Key
键在给定语言中可能采用不同的值,具体取决于Hello World
短语在该语言中需要使用的正式或非正式形式("What's up World","Yo World","Yo World",美好的一天世界",等等.
For example, the Hello_World_Key
key may take different values in a given language, depending on how formal or informal the Hello World
phrase needs to be in that language ("What's up World", "Yo World", "Good Day World", etc.).
您可以在注释字段中添加一个字符串,以向翻译者提示这种用法,翻译者(可能会认为)可以更好地本地化您的应用程序.
You can add a string in the comment field to hint this usage to the translator, who will (one would presume) be better able to localize your application.
这篇关于NSLocalizedString()的第二个参数是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!