[ACCEPTED]-What is the second parameter of NSLocalizedString()?-localization

Accepted answer
Score: 289

The second parameter is a comment that will 7 automatically appear in the strings file 6 if you use the genstrings command-line utility, which 5 can create the strings file for you by scanning 4 your source code.

The comment is useful for 3 your localizers. For example:

NSLocalizedString(@"Save",@"Title of the Save button in the theme saving dialog");

When you run 2 genstrings, this will produce an entry in 1 the Localizable.strings file like this:

/* Title of the Save button in the theme saving dialog */
"Save" = "Save";
Score: 76

The comment string is ignored by the application. It 11 is used for a translator's benefit, to add 10 meaning to the contextual usage of the key 9 where it is found in your application.

For 8 example, the Hello_World_Key key may take different values 7 in a given language, depending on how formal 6 or informal the Hello World phrase needs to be in that 5 language ("What's up World", "Yo World", "Good 4 Day World", etc.).

You can add a string in 3 the comment field to hint this usage to 2 the translator, who will (one would presume) be 1 better able to localize your application.

Score: 0

It's for just developer understanding on 5 the translation, that is you are giving 4 a key to get corresponding string from the 3 corresponding strings file.

The comment parameter 2 enables developer to understand what the 1 key represents...

More Related questions