IOS-International language switching

Source: Internet
Author: User

iOS internationalization: How to switch Languages 1, internationalization is to put tags, information and other information into the resource file, with the language required by the program to provide the corresponding resource files. With Key/value storage, the key value of each resource is constant, and value changes with the demand. The general change is to write "dead" things, network requests can not be changed. 2. Add multiple languages: New Project (internationalization)--International-->project-->info-->localizations--> "+" Chinese (Simplified)

--Finish:

3. Create Infoplist.strings: Modify the project name Language Cmd+n (new)-->resource--> strings File-->next
--Named Infoplist.strings--> creates-->finish Add properties: Click Infoplist.strings--> Right Locatize--> locatize-- > Cancel base, Tick Chinese, chinses (Simplified):--> Click on the left infoplist.strings lower triangle to add properties: Infoplist.string (中文版) Inside input: Cfbundledisplayname = "localizable"; infoplist.string (Chinese (Simplified)) input: Cfbundledisplayname = "internationalization"; At this time: the name of the project to the internationalization (Chinese), the corresponding English changed to: Localizable 4. Similarly create localizable.strings (step with 3): Modify the label display language in Localizable.strings (simplified Write down: "LabelText" = "Simplified Chinese"; Localizable.strings (English): "LabelText" = "It is Chinese"; Create a LabelText (Label object) in the VC:

UILabel *label = [[UILabel alloc]initwithframe:cgrectmake (100, 100, 175, 50)];

Label.backgroundcolor = [Uicolor Graycolor];

Label.text = nslocalizedstring (@ "LabelText", nil);

[Self.view Addsubview:label];

The results are as follows:

Get all languages and the current language:

IOS-International language switching

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.