1. New Project
New single View Application project, named Myinternational.
We choose to use our own language files instead of the localizable.string of the system, because multiple people operating the same file may cause conflicts when project development uses SVN.
Add a new strings File in resource:
Named Hello (remember targets to tick the item)
After the new is completed, the hello.string file is generated and dragged into the supporting files.
3, Configuration hello.string internationalization
First configure the hello.string file just now.
Click on the hello.strings file and click Make localized (localized) in the circle.
Only 中文版, no problem click OK
4. Internationalization of configuration Items
Many configuration methods on the network is not reliable, because the new version of the Xcode location "+" position changed, here to teach you the right way, click on the project--Select project-> Select info-> Click "+" number.
Click on the "+" number, add Chinese, of course, you can add other languages, pop-up dialog, Infoplist is the configuration system of international files, can configure the icon and other multi-language environment, not in the scope of this article, nib file to see the need to match, here choose not worthy.
After the configuration is complete, look at the hello.string and divide it into two files.
Complete the above four steps to complete the multi-language environment configuration within the project, below to see how the code is written.
5. Add the Required String
The corresponding language strings are added in Hello.strings (English) and Hello.strings (Chinese) respectively.
The format of the string is "key" = "value"; key-value pair (don't forget the semicolon!) )
Next, configure the required string for the item, a display for lable, and a display for the button.
Hello.strings (中文版)
"Invite" = "Hello Atany,come to join in us!";
"Buttoninfo" = "Change Language";
Hello.strings (Chinese)
"Invite" = "Hello Atany, come join us!" ";
"Buttoninfo" = "Switching language";
6. Look at the process
iOS in-app internationalization-The Lonely Moon-Blog Park