IOS internationalization Multi-language settings Xcode7

Source: Internet
Author: User

IOS internationalization multi-language settings

Way One:

1. Create a good UI in storyboard, then add the language you need in Project Localizables, and the default is englist; For example, here I have added Simplified Chinese

2. After the addition, the original Main.storyboard will be a more international language configuration file

3. Click on the main.strings file, you can configure the Chinese language here, automatically add now storyboard the above created UI control code, directly here to modify, the Sotyboard design is the understanding of the English state; Here is the Chinese state of the runtime;

/* Class = "UILabel"; Text = "LABEL A"; ObjectID = "I0m-dm-gzt"; */"I0m-dm-gzt.text" = "title A";/* Class = "UIButton"; Normaltitle = "button B"; ObjectID = "Xjx-jb-s2s"; */"Xjx-jb-s2s.normaltitle" = "button B"; " Crs-hi-bts.text "=" title C ";

4. Then when we add a new UI control on storyboard, the file here does not update automatically.

At this point we will find the object-id of the newly added control; Is the above crs-hi-bts such things, identification ID, and then manually add the above similar code;

How to go back has added new controls to the Object-id; Select the appropriate control on Storybrad, and then find Object-id in the property bar on the right.

Mode Two: Manually create the Localizable.strings file

New file, create Localizable.strings file; First select an English or add the Chinese, the last click on the file, in the right side of the property bar is checked you need to international language;

I am here in Chinese and English; Once selected, the same localizable.strings will expand into two files that have been developed internationally

Each of these two files is written with key = value;

中文版 inside: tname = "Name";

Simplified inside: tname = "name";

When used in code:

self. Titlelabel. Text = nslocalizedstring(@ "Tname", nil);

Can

Third: The internationalization of the app display name is also handled

It's similar to the above; just manually create a infoplist.strings file; also select the language that needs to be internationalized;

In English files and Chinese documents inside;

Write on the corresponding

Cfbundledisplayname = "Abs-en";

Cfbundledisplayname = "ABS-CN";

To

Four: In addition about the internationalization of the picture

You can prepare multiple sets of pictures, then in the strings file, the name can be processed

Reference: http://www.cocoachina.com/ios/20150114/10911.html

IOS internationalization Multi-language settings Xcode7

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.