Locale.UK 和国家/地区代码

发布于 2024-12-19 02:04:13 字数 185 浏览 3 评论 0原文

根据 ISO 2 字符代码 uk = 英国。但 Locale.UK.getCountry() 返回 GB。我错过了什么吗?

According to the ISO 2 character codes uk = United Kingdom. But Locale.UK.getCountry() is returning GB. Am I missing something?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

日久见人心 2024-12-26 02:04:13

根据

getCountry() 方法返回区域设置的区域或国家/地区成员的 ISO 3166 两字母缩写。

英国的 ISO 3166 两个字母缩写确实是 GB。 uk 不是标准的一部分,而更多的是历史偶然:

使用 .uk 而不是 .gb 作为顶级域是因为它已在(现已过时)JANET 名称注册方案中使用,其中地址组成部分的顺序被颠倒了。 DNS 中提供了 .uk,以简化这些地址之间的转换。有计划最终过渡到 .gb 以符合正确的用法,但这从未发生; .uk 的使用现已根深蒂固,不可能注册 .gb 域名。

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

According to this,

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

The ISO 3166 two-letter abbreviation for the UK is indeed GB. uk is not part of the standard, but more of a historical accident:

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.

Depending on your target use, you may need to replace .gb with .uk.

旧伤还要旧人安 2024-12-26 02:04:13

uk 的存在是出于兼容性原因(过去的一个错误)。

正确的 ID 是 gb

gb 保持标准的唯一地方是域名,但这超出了本问题的范围。

为了最大限度地减少潜在问题,您可以将 uk 重新映射到 gb

uk is there for compatibility reasons (a mistake in the past).

The correct id is gb.

The only place where gb remains standard is the domain names, but this is outside the scope of this question.

To minimize potential issues you could remap uk to gb.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文