“官方”数据来源 国家/地区列表
最近,我们开始遇到向网络应用程序的用户呈现过时的国家/地区列表的问题。
我们目前有一些数据库表来存储本地化的国家/地区名称及其地区(州)。 然而,随着地球的发展,该列表在不断演变,并且事实证明维护起来很痛苦,因为一些区域被删除,一些区域被合并 - 现有数据需要一直更新。
在处理多语言国家/地区列表时,最佳实践是什么(如果有)?
有地方或标准吗? 我知道 ISO 3166,但他们的列表并不完全适合数据库......而且它没有完全本地化。
理想的解决方案只是让我们“同步”它? 最好是多种语言。 该解决方案最好是免费的或基于订阅的,并包含更改的历史记录,以便我们可以更新我们的数据(又名 tblAddress)
谢谢!
Lately we've started getting issues with outdated countries / regions list being presented to users of our web-application.
We currently have a few DB tables to store localized country names along with their regions (states). However as the planet goes, that list is in constant evolution and it's proving to be a pain to maintain as some regions are deleted, some merged - existing data needs to be updated all the time.
What are, if any exist, the best practices when it come to dealing with multi-locale countries/regions list?
Is there a place or a standard in place? I know of ISO 3166, but their list isn't exactly DB friendly ... plus it's not fully localized.
An ideal solution would simply allow us to "sync" to it? Preferably in multiple language. The solution would preferably be free or subscription based with an historic of what changed so we could update our data (aka tblAddress)
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
geonames 在这方面相当准确,并且定期更新。
http://www.geonames.org/export/
geonames is pretty accurate in this respect, and they update regularly.
http://www.geonames.org/export/
哪有这回事。 这是一个政治问题,您只能在自己的应用程序中解决。 决定使用 ISO 3166 可能是最容易捍卫的。 我至少知道以下问题:
There is no such thing. This is a political issue, which you can only solve in the context of your own application. Deciding to use ISO 3166 could be the easiest to defend. I know of issues with at least:
ISO 列表此处是数据库友好的,尽管它们只包含短名称和代码。
The ISO lists here are DB friendly, though they only include short names and codes.
这个看起来非常好:多种语言,更新选项,独立于数据库用于导入的文件格式、国家/地区/城市信息以及您可能使用或不使用的一些其他功能。
如果您只需要一台服务器,那么它的价格相当实惠。
This one looks very good: Multiple languages, update option, database independent file format for import, countries/regions/cities information, and some other features you might use or not.
And it's quite affordable if you need it for only one server.
你可以试试 CLDR
http://cldr.unicode.org/
这组数据是由 Unicode 维护的组织。 它会定期更新,并且数据会进行版本控制,因此您可以轻松管理列表的状态。
You can try CLDR
http://cldr.unicode.org/
This set of data is maintained by the Unicode organization. It is updated regularly and the data is versioned so it is easy for you to manage the state of your list.
嘿! 您可以找到所有国家及其各自大陆的免费转储 https://gist.github.com/kamermans/ 1441495,它非常容易使用。只需下载转储并下载即可。 上传到您的数据库中。
Hy! you can find a free dump of all countries with their respective continents https://gist.github.com/kamermans/1441495, its much easy to use.just download the dump & upload in your data base.
好吧,等等,您只是想要一份最新的国家/地区列表吗? 或者你需要知道X国已经分裂为Y国和Z国吗? 因为我不知道有任何自动化方式来获取后者。 甚至 ISO 数据库的更新也以 PDF 形式分发(您需要自行实施更改)
Well, wait, do you just want an up-to-date list of countries? Or do you need to know that Country X has split into Country Y and Country Z? Because I'm not aware of any automated way to get the latter. Even updates to the ISO databases are distributed as PDFs (you're on your own for implementing the change)
欧盟维护有关地方行政单位 (LAU) 的数据,可以下载 作为多种语言的分层 XLS 文件。
The EU maintains data about Local Administrative Units (LAUs) which can be downloaded as hierarchical XLS files in several languages.
联合国统计司,统计使用的标准国家或地区代码 (M49)。
在页面左侧查找“搜索和下载:完整视图”。 这就是这里。
按大陆、次大陆区域、最不发达国家等对国家进行分组。
如果您无法导入 Excel 版本,请注意 csv 有未加引号的“字段和一个国家/地区名称中的逗号,这将破坏您的导入(“博内尔岛、圣尤斯特歇斯岛和萨巴岛”)。也许首先在 LibreOffice 或其他程序中打开它,修复损坏的国家/地区名称并将其其他最右侧的列分流回原位,然后将所有单元格设置为文本类型,在另存为对话框中选中 [编辑过滤器设置] [x] 并另存为 csv,并确保字符串分隔符设置为“,”。因为它应该是默认的。
United Nations Statistics Division, Standard country or area codes for statistical use (M49).
Look for "Search and Download: Full View" on page left. That leads here.
Groups countries by continent, sub-continental region, Least Developed Countries, and so on.
If you cannot import the excel version, note that the csv has unquoted" fields and a comma in one country name that will bust your import ("Bonaire, Sint Eustatius and Saba"). Perhaps open it first in LibreOffice or whatever, fix the broken country name and shunt its other right-most columns back into place. Then set all cells to type Text, saveAs csv with [Edit Filter Settings] checked [x] in the saveAs dialog, and make sure string delimiter is set to ", as it should be by default.