This tutorial is about localizing your Nib(.xib) files inside your iPhone application. I will write another tutorial to localized your application from your Xcode code as well. You might read few tutorials on Localization in iPhone but I am going to write for those who try those and didnt get success. So this tutorial is for one of my friend Waqas Qureshi.If you are not interested to read about theory please skip following two paragraphs.
What is Localization in iPhone? Translate your application in multiple languages. In simple words you want that your application will be easily understandable in different languages. So you want to localized your application in French/German or any other language. iPhone support more then 22 languages and I hope in SDK 3.0 it will support more then that. Localization is a very important feature which you can easily achieve in iPhone.
What are the steps? iPhone has a robust localization architecture that let you easily translate your application in to multiple languages. So its easy if you start your application with that architecture because it will be hard for you to convert your application localized at the end. So please make sure if you want to have this feature in your application, build your application accordingly and do not put this feature in phase two on your application.
Please follow the following steps to make your application localized. In this tutorial I will localized application in French. Output of this project will look like this for two languages (English and French)


1. Create a new project in Xcode and name it LocalizediPhone (I place it in Desktop)
2. Open LocalizediPhoneAppDelegate.m file in Xcode and change the applicationDidFinishLaunching method, such that it shows your TitleBar.
- (void)applicationDidFinishLaunching:(UIApplication *)application {
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
// Override point for customization after app launch
[window addSubview:navController.view];
[window makeKeyAndVisible];
}
3. Now open LocalizediPhoneViewController.m file and in viewDidLoad function write this code
- (void)viewDidLoad {
NSLocale *locale = [NSLocale currentLocale];
NSString *titleOFApplication = [locale displayNameForKey:NSLocaleIdentifier value:[locale localeIdentifier]];
self.title = titleOFApplication;
[super viewDidLoad];
}
4. Now run the application and you will see English in Title
5. Now change the language of your iPhone. Close this application(by pressing home button in iPhone) and open Settings application. Move to General > International > Region Format, and select French. Now click on Back button (International). Now selected Language row in International view and change your language to French. Press Done button and your iPhone will change the language.

6. Now in Xcode run the application again and you will see the change in Title.

7. Now it times to change in Xib Files. Open LocalizediPhoneViewController.xib from your Xcode and place 4 labels inside View.
8. Close the Xib file (LocalizediPhoneViewController.xib) and in Xcode “Group and files” panel expand “NIB Files”. Right click on it (LocalizediPhoneViewController.xib) and select “Get Info”
9. Now select “General” tab and in bottom left click “Make File Localizable”, you will be navigate to “Target”. Close this Info window and you will see under “NIB Files” an expander under “LocalizediPhoneViewController.xib” file. You will see “English” file. Right click on it and select “Reveal in Finder”. You will see a new folder inside your code project (English.lproj)
[Note: Nothing has been changed so far, you can run your application and it will behave the same way. Now it times to add French in your application. If it does not, do not get panic and continue reading below]
10. Now inside your Xcode project, right click on LocalizediPhoneViewController.xib file and select “Get Info”. Select “General” tab and click on “Add Localization” in bottom left. In popup type “fr” without quotes and press “Add button”. You will see fr will be added in Info window. Close this window and you will see “fr”(xib) file is added under English(xib) file. If you right click on “fr”(xib) file and select “Reveal in Finder”. You will see a new folder in your code project (fr.lproj)
11. Open “fr”(xib) file in interface builder. Change the text of labels in to French language(i use google translation).
Now everything is setup for this tutorial. If you are using iPhone simulator then select from menu “iPhone Simulator” and select “Reset content and settings”. It will make your iPhone simulator language to English. Open Settings application in iPhone, and move to “General”> “International”. Your “Region format” is “United States” and Language is “English”. (Your Setting screen should look like this.)
Open Xcode and run your application, it will be shown like this
[Note: If it does not show the changes we made. Do not worry about this, iPhone or iPhone simulator stored your application information in cache. So you have to remove your application from iPhone/iPhone simulator first. Then move to ~/Library/Application Support/iPhone Simulator/ ( here ~ means your home directory) and delete "User" folder. Clean your Xcode project by pressing Cmd+ Shift+K (or in menu go to "Build" > "Clean". Run the application again and it will show you the changes]
Now we want to see how its look like in French language. Repeat point 5 again and launch the application in Xcode. It will shown like this
[Note: If it still shown the English xib file please repeat the above note (i.e deleting the application from iPhone, cleaning your Xcode project and delete the User folder form ~/Library/Application Support/iPhone Simulator/).]
You can grab the code from here. Also you can get the complete list of country codes http://www.iso.org/iso/country_codes.html (i.e for Itly, German and other languages)
[Update: check out part 2 of localization]
Popularity: 26% [?]




















Here’s a post I just did with some more tips and tools for localization.
http://www.alexcurylo.com/blog/2009/05/06/tips-localization/
@Alex
I already written another tutorial about localization will share with you as well
Thank for sharing the link
Thanks for picking French! That was cool! Just a minor comment. To be consistent you would want to have all questions using either the familiar form (tu) or the formal form (vous). In case of the later the first question would become “Comment vous appelez-vous?”. In case of the former you would replace “vous” with “ta” (questions 2 and 3) and “ton” (question 4). For “hobby” I would suggest “passe-temps”?
Thanks for the article. I’ll be applying it soon!
@Geoffroy
I will change the text on weekend.
Thank you for your comments ( I am sorry, i do not know much about French)
Great tutorial. I guess that you’re using Google translation just for this tutorial, as machine translation will not give you good enough translation for real users.
This must be the iPhone localization guide week. It just so happens that I finished my own iPhone localization guide today:
http://www.icanlocalize.com/iphone_localization_guide.html
We’re running a translation service, and have commercial interest in this, but still I hope that our guide is helpful for anyone (or clients or not).
Why do we need two xib files ? Can’t we sent the questions text similar to how titleOFApplication is set ?
separate xib files may make sense if the UI elements are different for the locales?
I was going to ask the same question as “mcr”, if the interface is not different for each local why not just change the text labels based on the language chosen, why do you need to create another xib file, seems like a lot of extra un-needed work.
@James & MCR
I will check and let you know. I think its a must thing to do but i will verify this and update you tonight.
Hey thanks for the tutorial works like a charm! Just one question what can you do for alerts or action sheets? is there a way to localized them also?… because they are not in define in the xib file….
@MLBT
did you read the 2nd part of this tutorial series? check out http://adeem.me/blog/2009/05/10/tutorial-part-2-localizing-your-iphone-application/ might be helpful for you!
Hi, I am developing one iPhone application, in which I have to translate user data in other language. It is not web application but I can use Google translation services. So I cannot understand that how can I call that from my application.Can you help me for that?? Any suggestion??? Thanks.
@Mehta
I guess you have to call google something like this
http://translate.google.com.pk/translate_t#de|en|Ich%20bin%20fein
where you can see de= German & en = English and next to it is the sentence you want to translate. I guess it involves a little bit of parsing in objective C or on your server side.
@Adeem
I have tried link as you shown above but it doesn’t work. Do you have any other clue for that?? Thanks.
can you shear the code with me, i will check this out and tells you.
Hi adeem how can i localize the dynamic content,For example the content which i am retriving from web services.thanks a lot for the previous post.
Thanks Adeem for a nice tutorial. Keep it up. Just a quick question here what about the IBOutlets and action methods for the elements of particular nib file. Will we have to link them up separately i.e for en and fr files?
thank you this was really useful
My xcode(4.0.2) is not letting me change the fr.xib file, a lock appears every time I try to. Is there a setting that im missing?