I need to build an app which will be multilingual. For instance, the app will be released in France and the Netherlands. The user needs to select a language when the app first start for the first time. Is there an easier way to do this? In Xcode I saw something about localizations. Does this have anything to do with it?
问题:
回答1:
These are great resources for your localization efforts:
- Apple's own Internationalization Programming Topics
- How to Localize an iPhone App tutorial
- Localization Guide for iPhone
回答2:
Xcode 6.0 : It provides wonderful features for Internationalisation and Localisation. ("Localizing with Xcode 6" video). For quick usage I write some useful steps.
Step 1 :
click on project -> info -> scroll down -> localizations -> click on '+' and add your required language -> check as required -> Finish.
for xcode 6 : click on project -> change target to -> info > scroll down -> localizations -> click on '+' and add your required language -> check as required -> Finish.
Step 2 :
click on 'Supporting Files' -> right click -> New File -> select Resource on left-side list -> select 'Strings Files' -> next -> name it 'Localizable' -> create
Step 3 :
click on newly created file -> go to Utilities -> file inspector -> click on 'Localize..' -> check all language
Step 4 :
open Localizable.strings(English) write "help" = "I can't help you";
here "help" is a key "I can't help you" is a value. You may change them as your wish.
open Localizable.strings(French) or the language you have set. write accordingly and you can translate "I can't help you" to any said language.
Step 5 :
// for test
NSString *str = NSLocalizedString(@"help", Nil);
NSLog(@"%@",str);
We have done it. You may check.
Now, to test goto settings of device -> general -> International -> language -> select said language or the language you have chosen (There are limited languages). Run your app. Hope this will help you. It help me.
回答3:
I would suggest reading the I18n docs. You will never need to ask the user which language they use as this is obtainable through an API call, so you should do the smart thing and use whichever language they have preferred already on their device.