O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Demystifying NSLocalizedString and genstrings

NSLocalizedString and genstrings make it very easy to generate a Localizable.strings file for your app. However, the steps that they follow to generate the file are easy and worthwhile to understand. You can do all of this yourself.

A strings file is just a collection of key-value pairs. The key and the value are strings surrounded by quotes, and the pair is terminated with a semicolon:

"​K​e​y​1​"​ ​=​ ​"​V​a​l​u​e​1​"​;​
"​K​e​y​2​"​ ​=​ ​"​V​a​l​u​e​2​"​;​

You can create a strings file yourself and add it to your project just by dragging it into Xcode. Once you have added the file, you can create localizations of it for other languages using the file inspector.

Once you have ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required