java - Locale.UK 和国家代码

标签 java internationalization iso

根据ISO 2 character codes uk = 英国。但是 Locale.UK.getCountry() 正在返回 GB。我错过了什么吗?

最佳答案

根据 this ,

The getCountry() method returns the ISO 3166 two-letter abbreviation for the locale's region or country member.

ISO 3166 two-letter abbreviation英国确实是GB。 uk 不是标准的一部分,更多的是历史的偶然:

The use of .uk rather than .gb for the top-level domain is due to its pre-existing use in the (now obsolete) JANET Name Registration Scheme in which the order of address components were reversed. .uk was made available in DNS to simplify the translation to and from these addresses. There were plans for eventual transition to .gb to accord with correct usage, but this never occurred; the use of .uk is now entrenched, and it is impossible to register a .gb domain.

根据您的目标用途,您可能需要将 .gb 替换为 .uk。

关于java - Locale.UK 和国家代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8334904/

相关文章:

java - 使用ListView切换到不同的Activity

wordpress - WooCommerce - 翻译结帐页面上的单词

Javascript 日期问题返回比设置日期-时区少 1 天

php - 具有 TranslateBehaviour 的实体的非翻译属性

Php utf8 在 mysql 中失败,但在 csv 导入时正常

java - 如何使用 JsonFormat 注释或任何其他 Spring 日期注释验证即时类型字段的 ISO 标准格式的日期值?

currency - ISO 国家/货币数据

java - 无法理解递归函数的输出。

java - 数组列表索引 0 大小 0 错误

java - 如何从 Java 应用程序监听 Windows 事件?