How to use NSLocalizedString to localize your iOS app

Total Shares 1

If you’re required to develop an iOS app to support multiple languages or localizations, you can easily use the NSLocalizedString function in objective C to do so. Localisation of your iOS app means that when a user has set to his or her own native language in the iOS’s General -> Settings -> International as shown in the screenshots above, your app is able to display those labels or texts in the set native language.

My recent requirement is to develop an iOS app that supports both the English & Malay versions. So when a user uses Malay as default language on his or her iOS device, the localized text or labels will be shown instead of English. As shown in the attached screens.


Some code of objective C, which shows how the code uses NSLocalizedString for the tabs of a UITabBarController:

FirstViewController *b = [[ FirstViewController alloc ] init];

[self createTabBarItemForViewController:b title: NSLocalizedString(@”Latest”, @”Latest”) tag:0 selectedImage:@”feed30″ unselectedImage:@”feed30b” ];

UINavigationController *nff = [[ UINavigationController alloc] initWithRootViewController:b ];

[b release];
[a addObject: nff];
[nff release];

How to do it in Xcode?


1. Usually, when you’ve created a project in Xcode, the Xcode will create a en.lproj folder in your project folder. This folder will usually contain a default InfoPlist.strings, first “remove it from reference” from your Xcode (Please note: do NOT delete!)

2. Now create the localization file (Localizable.strings) for the language or localization that you wanna support in your app. In my case is Malay, thus I’ve created a folder called ms.lproj in the project folder & added the Localizable.strings file in it. (Format as shown below) (Go to finder on your Mac & locate your project folder, & create the folder). “ms” is the language code for Malay & you can find out what other language code (e.g. French, German) from here

My Localizable.strings file


3. So after you’re done, drag the folders (in my case are en.lproj & ms.lproj) into the Supporting Files of your Xcode project as shown in the screen shots above

4. Run (re-compile your project), now switch to the languages that app is supposed to support, in your iOS’s Settings -> General -> International, voila, now your app should show those localized texts or labels.

Total Shares 1

Leave a Reply