Before doing Garfield dog because is oriented to the international market, so some international operations of APP high requirements. To the language, but because of increased promotion efforts, some do not international language countries have also been promoted, as a result, app and AppStore in the default language setting has become Chinese, then run by Neta again
In fact, the above solution is their works inside set the default language for English, upload in AppStore also set English on the line. Okay, well, we step by step to make our project internationalization.
1 Let’s build a multi language file
To our international file named Localization, this random Kazakhstan
figure 1-1. a project file
2 let’s build a multi language file
Note Oh here, apple gave us a little bit small surprise, this multi language file must be named “Localizable” to be Xcode recognition.
figure 2-1.Localizable international file
Note Oh, there is a small hole! Below, we can look at our international engineering directory. Please click on the red box marked the button Oh, the reasons for the following
figure 2-2. click the button in the circle
3 add new language to our multi language file
Note, if not in accordance with the second operations you may encounter a problem that you cannot add new language you multi language file! For hair? That is because I can not find a multi language file, forgive me not to go down to the bar!
3-1. for multi language file add language
Click “+” after a lot of choice of language, there is not good I will not put out. Here are two cases:
(1). According to the second step, we can’t find the multi language file, and can’t add the language:
figure 3-2. only story and landing screen
(2). It is normal to add language to the required multi language file
figure 3-3. correct multi language add tick
figure 3-4 multi language expansion
4 multi language use
IOS according to your own judgement system of language use which language you use, such as simplified Chinese, and multi language folder has simplified Chinese documents themselves for the corresponding replacement. The use of API is
NSLocalizedString (< #key#> < #comment#>,)
“Key” is a multi language file corresponding to the keyword, comment is the content, you can write notes, can not write, iOS is by the key language according to the system to find the corresponding language text keyword substitution. But the selection of key words to respect the original, not simple, because behind the content, you figure simple and easy, “write less, you will find that all out of order.
Figure 4-1 international content
We do two documents a Chinese traditional, an English switching system language try ~ ~ ~ ~ ~ ~ ~ ~
5 picture internationalization
These things as not worth a hair.
+ (NSString *) getLanPicNameWithPicName: (NSString *) picName
If ([SYSTEM_LANG hasPrefix:@ “zh-Hans”)
Return [NSString stringWithFormat:@ “%@_hans”, picName];
Return [NSString stringWithFormat:@ “%@_en”, picName];
This is a I package, the picture name input, automatic “picture internationalization”. In fact, it is the name of the picture will be separated, but through the identification of the system language, and then give imageNmae a name. Look at the way my picture is named.
map 5-1. multilingual picture naming