Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

Localizing Strings

The most common tool for localizing strings is NSLocalizedString. This function looks up the given key in Localizeable.strings and returns the value found there, or the key itself if no value is found. Localizeable.strings is a localized file, so there is a different version for each language, and NSLocalizedString automatically selects the correct one based on the current locale. A command-line tool called genstrings automatically searches your files for calls to NSLocalizedString and writes your initial Localizeable.strings file for you.

The easiest approach is to use the string as its own key (the second parameter is a comment to the localizer):

NSString *string =

    NSLocalizedString(@”Welcome to the show.”,


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial