1. Localization (internationalization)
To solve the same app, display the content of the corresponding language in different languages of the device.
The implementation of localization can be divided into "visualization", "Pure Code" two ways.
visualize the way:
> Click on the project name, under the info (note under Project, not targets), under the Localizations column, add the language
> Click Xib or Storyboard, select File Inspector (first tab) in the rightmost section, select Language under Localization, and you will find that the original Xib,storyboard file will automatically create the file in the corresponding language.
> in Xib,storyboard files in different languages, set the text of the view.
Pure Code Mode :
> Add the Localizable.strings file under the project directory, note that the name must be localizable, otherwise it cannot be localized .
> Localize this file, select the file, and add the language under File Inspector->localization
> Add the following format in different language versions of this file: "a1" = "abc"; Note that you have to take a semicolon, otherwise parse the error, and the name A1 in two files.
> in code lb.text = nslocalizedstring (@ "A1", nil)
In the actual development process, two ways to use, because different languages because of the different types of space occupied by different, resulting in the size of the control will vary, sometimes need to adjust in the interface file.
2. Application name localization
> Add Bundle display name to Info.plist
> Right-click on Show Raw keys/values (native underlying key value) in Info.plist file blank
> Copy the Cfbundledisplayname (corresponding Bundle display name)
> New infoplist.strings file, [note name, otherwise cannot localize], and localize this file, select the file, add the language under File Inspector->localization
> Add content in the following format in different language versions of this file: Cfbundledisplayname = "MyApp";
3. The application dynamically obtains the data localization, because these content is generally obtains by the network access, the different language content is provided by the server, the app only needs to provide the current device the language to the server, the server returns the content of the given language.
> Get the language of your device
[Nslocale Preferredlanguages]//Language preference list, the first one is the device's current language
Localization (internationalization)