英文:
How to get a country's official name from a Java Locale?
问题
在ISO-3166中,涉及国家时,“短名称”和“完整名称”之间存在差异。
例如,丹麦(链接至iso.org参考:https://www.iso.org/obp/ui/#iso:code:3166:DK)。
其国家代码将为DK和DNK(alpha-2和alpha-3),其数字代码为208,其短名称为'丹麦',其完整名称为'丹麦王国'。
对于我的当前项目,我已经拥有了所需的所有信息,除了完整名称。
是否有人知道获取这种数据的方法?
英文:
In ISO-3166, when it comes to the country, there is a difference between "short name" and "full name".
For example, Denmark (link to iso.org reference : https://www.iso.org/obp/ui/#iso:code:3166:DK).
Its country code would be DK and DNK (alpha-2 and alpha-3), its numeric code is 208, its short name is 'Denmark', and its full name is 'the Kingdom of Denmark'.
For my current project, I have all the information I need except full name.
Does anyone know of a way to get that kind of data?
答案1
得分: 1
Java的内置本地化不支持官方的国家名称。
以下是丹麦的条目在本地化数据中的内容:
DK=丹麦
你可以使用类似于https://restcountries.eu/的REST API,或者我找到了这个CSV文件,它似乎包含了你需要的内容。你需要解析它。
英文:
Java's in-built localization doesn't support official country names.
Here's the entry for Denmark in the localization data
DK=Denmark
You can use a REST API like https://restcountries.eu/, or I found this CSV file which seems to contain what you want. You will need to parse it.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论