[Java] [45] acquisition system locale

Preface:

For example, a official website, there are three languages, requires the user's language environment, prioritize corresponding language page

text:

Language = String HttpHelper.getRequest () getLocale () getLanguage ();.. 
String Country = .. HttpHelper.getRequest () getLocale () getCountry (); 

// continent is short, Hong Kong and Taiwan is traditional, so have then Analyzing the country field 
IF (( "ZH") the equals (langType) && ( "the CN." ) .equals (country)) {             
  Language = "SC"; // Simplified Chinese             
}

Language abbreviation:

English:en ;Chinese:zh;

Countries and regions abbreviations:

China: CN; Taiwan Province: TW; Hong Kong SAR: HK;

Reference blog:

National language abbreviation

http://www.loc.gov/standards/iso639-2/php/code_list.php

Countries and regions shorthand

https://blog.csdn.net/wjw_java_android/article/details/20458507

 

Guess you like

Origin www.cnblogs.com/huashengweilong/p/11349139.html