IOS Development Learning 35 localization, ios development 35 Localization

Source: Internet
Author: User

IOS Development Learning 35 localization, ios development 35 Localization
Add a new language to open Project-Info-Localizations

Click + add language under Localization

Define multi-language Files add String Files

On Supporting Files, add String Files named Localizable. strings

Set

The settings are displayed as follows:

String Localization

Define Localizable. strings (English)

"welcome"="Welcome";

Define Localizable. strings (Simplified)

"Welcome" = "welcome ";

Call in code:

_lbl.text=NSLocalizedString(@"welcome", nil);
Resource Localization

Select the image to be localized in the storyboard, add chinese (zh-hans) in Localization in File Instpector, and store different versions of images in en. lproj and zh-Hans.lproj respectively.

Get the current language through code
   NSArray *languages = [NSLocale preferredLanguages];   NSString *currentLanguage = [languages objectAtIndex:0];   NSLog(@"language is %@",currentLanguage);
IOS switching Language

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.