--app Localization of the iphone development must-know point

Source: Internet
Author: User

1. In the custom resources directory Localizables Right-click, select New File,

Then choose the strings file resource want

Click Next, the file name is defined as "Localizable.strings", select the directory you want to save, create

2. Select the Localizable.strings file

In the tool panel on the right, click on the "+" key to add English and Chinese, respectively.

The directory structure on the left will become

The corresponding directory will generate two corresponding English en.lproj and Chinese zh-hans.lproj directories, as well as corresponding localizable.strings files.

As follows:

3. Localization

Localizable.strings the way a list of key-value pairs is used to localize application data

The format is:

"Key" = "value";

Where the input colon, equal sign, when good, must be in English state

Like what:

Write in Localizable.strings (中文版) file

"TestKey" = "test";

Write in Localizable.strings (Chinese) file

"TestKey" = "test";

When used, simply call system macro nslocalizedstring to use language to set unrelated string data

Form: nslocalizedstring (@ "key", nil)

Like what:

Nslocalizedstring The first parameter is the corresponding key name, the second parameter is a custom description, you can pass nil

4. Localization of application names

Edit Info.plist, add application has localized display name entry, set the value to Yes

If the program generates a infoplist.strings file automatically, if not, create one, and do the same 1 and 2 steps

Cfbundledisplayname values are defined in Infoplist.strings (中文版) and Infoplist.strings (Chinese) respectively

"Cfbundledisplayname" = "app name";
"Cfbundledisplayname" = "app name";

Set default setting to Chinese: Edit info.plist, add localization native development region entry, set to China

5. Image and Xib file localization similar, also can add the same name picture file and Xib file in the corresponding en.lproj and zh-hans.lproj directory

Then add files to the project list

--app Localization of the iphone development must-know point

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.