Xcode4 localization Summary

Source: Internet
Author: User

1 xcode: it runs on the 3.1.2 system and can display Chinese normally. However, the system running on Versions later than 4.0 always shows that English internationalization is abnormal.

In ios4 or above, if it is simplified Chinese, put the international file in the zh-Hans.lproj will show normal. It cannot be placed in Zh. lproj.


2. localized strings

1) Right-click "new file" in the "supporting files" directory of the project and select the IOS resource item on the left side of the pop-up window. The "string file" icon is displayed on the right. Create this file. The new file name must be written"Localizable. Strings" must be

2) click the file you just created and select "View"-"utilities"-"file inspect" from the menu of xcode4. Some property information is displayed on the right.

3) Find the localization option. It should be empty now. Click "+" to add the domain name to the international market. Because I only made Chinese and English, I added "English" and "Chinese ".Select zh_hans for "Chinese". This is simplified Chinese..

4) after adding, you can see that your project directory will generate the corresponding directory, the zh-Hans.lproj and EN. lproj directory is localizable. Strings File

5) in xcode4, you can see a triangle icon on the left side of the previously created localizable. Strings file. After you click it, two files, one Chinese file and one English file, will be expanded. Click Edit for each file.

6) The format of the file is "key" = "value"; the semicolons must all be in English.

7) in the programTo use an international string, call nslocalizedstring(@ "About",Nil) To display strings.. The first string is the key in the file, and the second string can be replaced by nil or some comments can be written.


3. localized application name

1) Create an empty file named infoplist. Strings
Generally, the program can automatically produce this file.


2) localize infoplist. Strings. Click infoplist. Strings
. Select View> utilities> file inspect ". Click the + plus sign under the Localization Option

Add Chinese
(Zh-Hans) type is simplified Chinese. English should be added automatically. In infoplish. Strings, there will be two more Chinese-English files.

 

3) in this English version. Edit different infoplist. Strings files and set the display name


Cfbundledisplayname = "name ";


4) EDIT info. plist, add a new property application has localized display name, set its type to boolean, and set its value to the selected status.

Summarize these

4. NIB file and image Localization

First, the image on xcode4 cannot be directly localized. After the NIB file is localized, the corresponding image localization process is similar.

Localized nib files. 1) Click the NIB file and select "View"-"utilities"-"file inspect". Some attribute information is displayed on the right. Or press the shortcut key command + Option + 1.

In Localization
Under the option, click the + plus sign to add Simplified Chinese (zh-Hans. English
It should be automatically added.


Localized images. Only after the NIB file is localized can the image be localized. 2) Click the image.

Select "View"-"utilities"-"file inspect", and some attributes are displayed on the right. Or press the shortcut key command + Option + 1.

In Localization
Under the option, click the + plus sign to add Simplified Chinese (zh-Hans. English
It should be automatically added.

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.