什么是*comment
参数:
NSString *NSLocalizedString(NSString *key, NSString *comment)
如果我这样做:
NSLocalizedString(@"Hello_World_Key", @"Hello World")
并且有两个版本的 Localizable.strings(英语和西类牙语),是否每个都需要条目:
English.lproj/Localization.strings: @"Hello_World_Key" = @"Hello World";
Spanish.lproj/Localization.strings: @"Hello_World_Key" = @"Hola Mundo";
英文不是多余的吗?
最佳答案
第二个参数是一个注释,如果您使用 genstrings 命令行实用程序,它将自动出现在字符串文件中,它可以通过扫描您的源代码为您创建字符串文件。
该评论对您的本地化人员很有用。例如:
NSLocalizedString(@"Save",@"Title of the Save button in the theme saving dialog");
当您运行 genstrings 时,这将在 Localizable.strings 文件中生成一个条目,如下所示:
/* Title of the Save button in the theme saving dialog */
"Save" = "Save";
关于ios - NSLocalizedString() 的第二个参数是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1442822/