I just updated to Xcode 4.
Normally when localizing apps we add "Localizable.String" file to the project, and then navigate to "Get Info" menu and click the "Make It Localized" button.
However, in Xcode 4, there is no "Get Info" menu.
When I try to add a language it only effects the "InfoPlist.String" file (which can only localize the app's name).
How may I add localization to my app in Xcode 4?
Click on iOS->App/Single View App->Next. Name your project and select the language as Swift. Select a desired location and click on Create. To start with Localization, click on your Project Name -> go to Info Tab -> Under Localizations, click on the '+' button.
Open Info tab, and click “+” button under Localizations section. Then choose a language you want to support from the dropdown list shown. XCode opens a dialog showing resources to be added for the new language.
Select the project and under “Localizations”, click the “+” icon. Add any language you want (I selected Italian) then click on “Finish”. Now go back to Localizable. string file, select it and on the File Inspector (right menu) select “Localize”.
It's simple once you understand it.
If you want to accomplish this with Xcode 5.x and iOS 7 or Xcode 6.x and iOS 8, check out "How to localize my app with Xcode 5?" instead.
I liked SNR's link, but his answer was a bit short.
Also, I see that this question is a bit old, and my answer may be different from older versions of Xcode. (I used Xcode v. 4.3.3)
However, i have updated my answer to work with both Xcode 4.3.5 and below + 4.4 and above (and Xcode 5.x and 6.x here: How to localize my app with Xcode 5?).
To begin you should add a new "Strings File" in the iOS Resource category.
Next, create the file as "Localizable.strings".
When the file is created, select it and open File Inspector .
EDIT: Things have changed (a bit) with the new Xcode 4.4, 4.5 (and above) (for iOS 6 support). If you'r Not using Xcode 4.4 or above, joust skip this step.
{ The Xcode 4.4, 4.5 (and above) way:
Click the "Make localized" button
Now head over to your Main Project page.
And click the "+" button under Localization, and select the languages you want to support.
(I'll select German / Deutsch)
Now a window will appear asking you what files you want to localize, make sure Only the "Localizable.strings" file is selected and click Finish.
}
{ The Xcode 4.3.5 and below way:
Click the "+" button under Localization, and select the languages you want to support.
(I'll select German / Deutsch)
}
.
.
.
.
You should now see that you have two files under the "Localizable.strings" file.
Next, add your localization strings inside both of the localization files.
Now here comes the coding part.
Here i'll simply declare a UILabel
and set it's text to the Localizable file string.
Declare:
IBOutlet UILabel *testLabel;
And Inside ViewDidLoad i'll set the text using NSLocalizedString
:
[testLabel setText:NSLocalizedString(@"TEST", nil)];
To finish up, just connect our testLabel
in "Interface Builder".
Now you should be able to run the Project and see the localized string. And if you change the language, you should see the localized string change as well.
Select the file you want to localize and klick on the file inspector in the utilities section. There is a section Localization
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With