Localization in the iphone development process

Source: Internet
Author: User

Online tutorials on this issue countless, but the implementation of the process encountered a little trouble

Common localization:

1. Create a new document under the Resources category (right-click/add/new File ...)
2. Select Other in the Template dialog box and then select Strings file or Empty file (my xcode goes to the Maxos tab, not the iOS tab)
3. Set the file save name to Localizable.strings
4. Right-click on the localizable.strings file and select Get Info
5. Click Make File localizable on the info screen, and then switch the Tab tab to the general
6. Enter a new language name zh then press ADD, some of which have English and ZH,JP languages, and you can add other languages as well.


Using nslocalizedstring in source code to reference internationalized files

Xxlabel.text =nslocalizedstring (@ "Text1", @ "");


Generate a key file
Open terminal, and then CD to the directory where the project is located CD ~/work/text1 and then


Genstrings-o english.lproj./classes/*.m
Genstrings-o zh.lproj./classes/*.m

Genstrings-o ja.lproj./classes/*.m


Localizable.strings will be one more triangle, pull up will have just added 3 language files, in each file to add the string to be translated, for example: "Text1" = "Text1"; "Text1" = "Text 1"; "Text1" = "テキストの1"


Localized processing of the name of the program should be:

For example, under the English environment, the program name is game, Chinese is called games

This needs to be written to info. Plist's Cfbundledisplayname, in Apple's Official document: http://developer.apple.com/library/ios/#documentation/general/ REFERENCE/INFOPLISTKEYREFERENCE/ARTICLES/COREFOUNDATIONKEYS.HTML#//APPLE_REF/DOC/UID/20001431-102193 has comments


To write to the infoplist.strings.

Method One
1) Localize the Info.plist, then set the required language (such as Simplified Chinese ZH_CN), set the language corresponding to the localization native development region;
2) Create an empty file named Infoplist.strings
3) Localize the Infoplist.strings (Get Info-and make Localization) and set the desired language (Simplified Chinese ZH_CN)
4) Edit different infoplist.strings files, set the display name, such as: Cfbundledisplayname = "Game";

Method Two
1) Edit Info.plist, add a new property application has localized display name, set its type to Boolean, and set its value to selected
2) Create an empty file named Infoplist.strings
3) Localize the Infoplist.strings (Get Info-and make Localization) and set the desired language (Simplified Chinese ZH_CN)
4) Edit different infoplist.strings files, set the display name, such as: Cfbundledisplayname = "Game";


The difference between infoplist.strings and localizable.strings:

Original: http://lists.apple.com/archives/carbon-dev/2007/Mar/msg00167.html
What ' s the difference between these and the files? is infoplist.strings only for properties found in Info.plist?
Yes. If you want strings in info.plist to being localizable, put them in infoplist.strings.


By the above steps, my app localization is now OK.


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.