iOS in-app internationalization-The Lonely Moon-Blog Park

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.