Ios determines whether the system language is simplified Chinese or traditional Chinese

Source: Internet
Author: User

In cocos2d-x, the following methods can be used to determine whether it is Chinese or other languages

       //default language is local language        ccLanguageType currentLanguageType = CCApplication::sharedApplication()->getCurrentLanguage();        switch (currentLanguageType)        {            case kLanguageEnglish:                language_ = "english";                break;            case kLanguageChinese:                language_ = "zhcn";                break;            default:                language_ = "english";                break;        }    }

However, I want to judge whether it is simplified Chinese, or traditional Chinese, turning over the cocos2d-x of the definition of cclanguagetype inside oh.


Ccapplication: sharedapplication ()-> getcurrentlanguage (); the following method is changed. So I found the method.

// Whether it is a traditional Chinese bool container agemanager: istaiwanchinese () {// get the current language and country config nsuserdefaults * defaults = [nsuserdefaults standarduserdefaults]; nsarray * Languages = [ults objectforkey: @ "applelanguages"]; nsstring * currentlanguage = [ages objectatindex: 0]; If ([currentlanguage istattostring: @ "ZH-HANT"]) {return true ;} else {return false ;}}

Then, you can use the following code to determine whether it is simplified Chinese or traditional Chinese.

// Default language is local language ccLanguageType current1_agetype = CCApplication: sharedApplication ()-> getCurrentLanguage (); switch (current1_agetype) {case k1_ageenglish: language _ = "english"; break; case kmeanagechinese: // determine whether it is simplified or traditional. // if it is traditional, if (isTaiWanChinese () = true) {language _ = "zhcnt ";} // It is a simplified else {language _ = "zhcn" ;}break; default: language _ = "english"; break ;}}


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.