IOS Multi-language support

Source: Internet
Author: User

If the app is going to be internationalized in the future, for example, China needs to use it, the United States needs to consider the app to support multiple languages

The specific way is as follows


First, create a new Strings in supporting files


Named: Localizable


Start configuration



If the language you want to choose is missing from the point-in-turn option



For example, if you need to select French, you can add the following ways




After the configuration is complete we go back to the newly created localizable.strings open and find the file that generated the corresponding language

Our example adds only Simplified Chinese English and then adds the string separately




"Test" = "testing";

"Test" = "test";


Use the following method

    Gets the current system language setting    nsuserdefaults *defaults = [Nsuserdefaults standarduserdefaults];    Nsarray *languages = [Defaults objectforkey:@ "Applelanguages"];    NSString *currentlanguage = [languages objectatindex:0];    NSLog (@ "%@", currentlanguage);        Set the user language to the current system language    [Defaults setobject:currentlanguage forkey:@ "user_lang_string"];            You can use Nslocalizedstring to invoke.    nsstring *strtest = nslocalizedstring (@ "Test", @ "");        Test button    UIButton *registbtn=[uibutton Buttonwithtype:uibuttontypesystem];    Registbtn.frame=cgrectmake (a);    [Registbtn settitle:strtest forstate:uicontrolstatenormal];//the use of strtest here will be automatically identified according to the phone system language    [Self.view addsubview : REGISTBTN];    

The text of the button in the example is automatically recognized by the system language



If there is a problem can add QQ discussion

Apple Development Group: 414319235 Welcome to Join



IOS Multi-language support

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.