IOS text and pictures of the internationalization of the use of small pits and remind

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

IOS text and pictures of the internationalization of the use of small pits and remind
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.

IOS text and pictures of the internationalization of the use of small pits and remind
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

IOS text and pictures of the internationalization of the use of small pits and remind
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!

IOS text and pictures of the internationalization of the use of small pits and remind
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:

IOS text and pictures of the internationalization of the use of small pits and remind
figure 3-2. only story and landing screen

(2). It is normal to add language to the required multi language file

IOS text and pictures of the internationalization of the use of small pits and remind
figure 3-3. correct multi language add tick

IOS text and pictures of the internationalization of the use of small pits and remind
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.

IOS text and pictures of the internationalization of the use of small pits and remind
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.

IOS text and pictures of the internationalization of the use of small pits and remind
map 5-1. multilingual picture naming

Count iOS development has been almost two years, the first time to write an article, feel a bit harder than the knock code, but share the feeling makes me very comfortable, hope to have the opportunity to participate in the open source project in github. The next time I will share with you how I set up a git server in the network, and we hope to exchange a lot ~ thank you O (a _ U) O~