前言:

比如一个官网,有三种语言版本,需要根据用户的语言环境,优先显示对应的语言页面

正文:

String language = HttpHelper.getRequest().getLocale().getLanguage();
String country = HttpHelper.getRequest().getLocale().getCountry();

//大陆是简写,香港台湾是繁体,所以还得再用country字段判断下
if(("zh").equals(langType) && ("CN").equals(country)){            
  language = "sc"; //简体中文            
}

语言缩写:

English:en ;Chinese:zh;

国家及地区缩写:

中国:CN;台湾省:TW;香港特别行政区:HK;

参考博客:

各国语言缩写

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

国家和地区简写

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

 

相关文章:

  • 2022-12-23
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2021-12-21
  • 2022-12-23
  • 2021-11-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-20
  • 2021-12-26
  • 2022-12-23
  • 2021-05-29
  • 2021-06-08
相关资源
相似解决方案