cell.textLabel.text NSLocalizedString parameters

394 Views Asked by At

I am just wondering what the second parameter to NSLocalizedString is used for.

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

There are 2 best solutions below

0
On BEST ANSWER

The second parameter to NSLocalizedString is a comment used to describe the text such as where it is used. When genstrings is used to create the base .strings file the comment helps a localizer understand the context.

0
On

The first string in NSLocalizedString is what will be printed as the string you want the user to see. This can also be a key for Localizable.strings.

The second parameter is like a description, or comment for this string.

You can use the genstrings command-line utility, which can create the strings file for you by scanning your source code and finding NSLocalizedString's.

How to use genstring: http://steelwheels.sourceforge.jp/Documents/genstring.html

Example:

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

Localizable.string

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