If your app needs support for multiple languages. Then, you should add "internationalization" support for your app app. "Internationalization" at first glance is very advanced. In fact, Apple Xcode has been set up for us, we just need to simple configuration, we can complete. "Internationalization" as its name implies, is to allow people in countries to use your app to display the native language of their users. There are many such posts on the web, but Xcode is evolving and many things have moved or become easier. In this way, we can no longer look at the old posts. Not much nonsense!
The internationalization language pack is generated under XCode 5.0.
1. Create an Internationalized language file: The file name must be: Localizable.strings
2. Select the Localizable.strings file, and in Utilites, click the localizable option
3. Create an English language pack. After creation, your localizable.strings file will be hung in the English language support file.
4. Add additional multi-lingual support as needed.
Click Finish directly.
In fact, we should note that in the Plish file, the default language pack is switched.
Add language support. Let's take my file as an example: in Localizable.strings (Chinese (Simplified)), add the following code:
"Play" = "play";
In Localizable.strings (中文版), add the following code:
"Play" = "play";
Other, identical ...
Use language support
NSString *strplay = nslocalizedstring (@ "Play", @ "");
[Self.btnplay Settitle:strplay Forstate:uicontrolstatenormal];
get the language of the current device
Get user default information
Nsuserdefaults *defaults = [Nsuserdefaults standarduserdefaults];
Get all the language settings supported by the IPhone
Nsarray *languages = [defaults objectforkey: @ "Applelanguages"];
NSLog (@ "%@", languages);
Get the current iphone language
nsstring* currentlanguage = [languages objectatindex:0];
NSLog (@ "Current language:%@", currentlanguage);
It's simple! So so!
ios-Build Internationalization Pack-configure app multi-language support