Home > Blogs > Cocoa Tip of the Day, 1/8/10

Cocoa Tip of the Day, 1/8/10

Think about localisation early.

Cocoa provides a lot of features for making it easy to localise your code.  Nib files can be stored per-language and translated as required.  Strings can be looked up from a strings file in a bundle with a single function call.  Dates can be stored in a locale-agnostic way and converted to a specific calendar for display.  Use these in your code from the start - don't wait until you've finished before you start thinking about supporting translation.  If you cache locale-specific information anywhere, make sure that you listen for an

NSCurrentLocaleDidChangeNotification
and update the cache afterward.

I've expanded this tip, as I will do each Friday in January, into a full article: Localizing Cocoa.

Cocoa Programming Developer's HandbookFor more tips, please see my new book,
Cocoa Programming Developer's Handbook,
available in print and electronic formats.