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’s a resource file that you add to your application, but you don’t need to do a lot of work to get data from it.

Whenever you have a string in your code, it appears like this:

 ​ ​ ​ ​@​"​H​e​l​l​o​!​"​

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

N​S​S​t​r​i​n​g​ ​*​t​r​a​n​s​l​a​t​e​d​S​t​r​i​n​g​ ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.