NSLocalizedString() 的第二个参数是什么? [英] What is the second parameter of NSLocalizedString()?
问题描述
什么是*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
短语在该语言中的正式或非正式程度("Whats up World"、Yo World"、Good Day 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() 的第二个参数是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!