【问题标题】:cell.textLabel.text NSLocalizedString parameterscell.textLabel.text NSLocalizedString 参数
【发布时间】:2012-01-31 20:02:53
【问题描述】:

我只是想知道NSLocalizedString 的第二个参数是做什么用的。

cell.textLabel.text = NSLocalizedString(@"Detail", @"Detail");

【问题讨论】:

标签: iphone ios uitableview uitextfield nslocalizedstring


【解决方案1】:

NSLocalizedString 的第二个参数是用于描述文本的注释,例如它的使用位置。当genstrings 用于创建基本 .strings 文件时,注释有助于本地化人员理解上下文。

【讨论】:

    【解决方案2】:

    NSLocalizedString 中的第一个字符串将打印为您希望用户看到的字符串。这也可以是 Localizable.strings 的 key

    第二个参数类似于此字符串的描述或注释。

    您可以使用 genstrings 命令行实用程序,该实用程序可以通过扫描您的源代码并找到 NSLocalizedString 来为您创建字符串文件。

    如何使用genstringhttp://steelwheels.sourceforge.jp/Documents/genstring.html

    示例:

    NSLocalizedString(@"SomeStringKey",@"An example of how to use this string.");
    

    Localizable.string

    /* An example of how to use this string. */
    "SomeStringKey" = "An Example String";
    

    【讨论】:

      猜你喜欢
      • 2017-10-15
      • 2015-11-26
      • 1970-01-01
      • 2010-11-29
      • 1970-01-01
      • 1970-01-01
      • 2011-03-27
      • 1970-01-01
      • 2011-12-14
      相关资源
      最近更新 更多