为en-US和en_US创建区域设置有什么区别? [英] What is the difference between creating locale for en-US and en_US?

查看:255
本文介绍了为en-US和en_US创建区域设置有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在表中拥有所有resourcebundle值,并按照要求进行格式化。我必须根据页面顶部的下拉列表中的用户选择更改网站中的语言。如果我使用语言代码作为en_US,那么它的工作正常。如果我使用en-Us作为语言代码,那么它不起作用。可能是什么问题。哪个是正确的?

I am having all my resourcebundle values in table and formatted as per requirement.i have to change the languages in the website based on User selection in drop down in top of the page. If i use language code as en_US then its working fine. if i Use en-Us as Language Code then its not working. What might be the problem. Which is correct to follow?

推荐答案

en是ISO 639指定的语言代码。而US是由国家代码指定的3166.

在Java中,Locale对象将语言识别为 languageCode_countryCode (例如en_US),而不是 languageCode-countryCode

"en" is the language code specified by ISO 639. while US is country code specified by 3166.
In Java, the Locale object recognizes the language as languageCode_countryCode (e.g. en_US) and not as languageCode-countryCode.

这篇关于为en-US和en_US创建区域设置有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆