NSLocalizedString() and Strings Tables

In many places in your applications, you create NSString instances dynamically or display string literals to the user. To display translated versions of these strings, you must create a strings table. A strings table is a file containing a list of key-value pairs for all of the strings that your application uses and their associated translations. It is a resource file that you add to your application, but you do not need to do a lot of work to get data from it.

You might use a string in your code like this:

N​S​S​t​r​i​n​g​ ​*​g​r​e​e​t​i​n​g​ ​=​ ​@​"​H​e​l​l​o​!​"​

To internationalize the string in your code, you replace literal strings with the function NSLocalizedString.

N​S​S​t​r​i​n​g​ ...

Get iOS Programming: The Big Nerd Ranch Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.