Xcode5 localized multi-language Localization

Source: Internet
Author: User

I. Application name Localization

I have read a lot of methods before xcode5 on the Internet, but I can't use xcode5.0.2 on the Internet. I tried it myself (Environment os10.9.4, xcode5.1.1 ), it took a lot of time to record the entire process.

1. Click project -- info -- localizations -- "+" and select Chinese (traditional) (zh-Hans)

2, click Finish, the project will be two files en. lproj, zh-Hans.lproj

3. In the current file structure, add cfbundledisplayname = "localized"; and cfbundledisplayname = "localized" to the file respectively. [This is a little different from others'.]

4. Change the value of bundl display name to cfbundledisplayname. For example, [This is a little different from others]. After running the command, you can switch the language in the settings on the iOS device to implement application localization.

 

 

Ii. String Localization

1. Command + N create a strings file named localizable. Strings. Otherwise, nslocalizedstring (@ "teststring", nil) will not be found. You can only use the method instead.

Nslocalizedstringfromtable (Key, TBL, comment), where TBL is the name of. Strings.

 

2. Click localizable. strings file --> command + Option + 1 (xcode-> View-> utilities-> file inspector) --> localization --> click localiz... --> select the Chinese language you just added -- localize

 

3. Select localizable. strings file --> command + Option + 1 --> localization --> select the added language --> localizable. A triangle exists in front of the strings file, indicating that a file has been added.

4. Add a language localization key-Value Pair

Add a Chinese key-Value Pair (for example, "teststring" = "test string";) to the localizable. Strings (Chinese (simplified) file ";)

Add a Chinese key-value pair to the localizable. Strings (English) file (for example, "teststring" = "test string ";)

 

3. Changes in procedural Images

Method 1: The method is similar to that of the localized string (but the image name cannot be the same)

Method 2: This method is more formal (similar to the local string) steps are as follows:

① Select the image you want to localize, such as "icon.png"

② Command + Option + 1. In localization, click localiz...

③ Add Chinese (zh-Hans). An inverted triangle will appear on the left of the image. When you click it, two pictures of (English) and (Chinese) will appear, in the project folder, en. lproj file and zh-Hans.lproj file; en. lproj files are stored in the English version of the image, zh-Hans.lproj is stored in the Chinese version of the image, the same as the English image name, we can directly replace the picture in the folder.

④ Use the normal name directly during the final use, for example, "icon.png"

 

4. localize other files

Localization of other files is similar to the second method of localization images. First add a language in localization, then copy the corresponding version to the EN. lproj and zh-Hans.lproj folders, and finally reference it.

 

Finally, I would like to thank the two bloggers for sharing their ideas.

Http://blog.csdn.net/wangqiuyun/article/details/7875442

Http://blog.csdn.net/nogodoss/article/details/17170605

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.