We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 9 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(9)
julianromera 和 instine 的答案合并:
julianromera's and instine's answers merged:
我认为联合国或 ISO 实际上以 CSV 格式发布了该列表。这将是最终的来源。
不过,我不确定他们是否免费发布。
编辑:实际上,该链接位于您链接到的维基百科文章中。美国国会图书馆已被 ISO 指定为官方注册机构,并发布 整个、官方、最新的列表,作为免费解析文本文件的小工具。
格式如下:
这是由竖线分隔的 5 个字段:
所以,这个 < em>实际上是 CSV 格式,如果您将其解释为字符分隔值而不是逗号分隔值(大多数 CSV 解析器都允许您这样做)。
I think the United Nations or the ISO actually publish that list in CSV format. That would be the ultimate source.
However, I'm not sure if they publish it for free.
EDIT: Actually, the link is in the Wikipedia article you linked to. The US Library of Congress has been designated the official registration authority by the ISO and they publish the entire, official, up-to-date list as a trivial to parse text file for free.
The format looks like this:
That's 5 fields separated by vertical bars:
So, this is actually in CSV format, if you interpret that as character separated values instead of comma separated values, which most CSV parsers let you do.
您还可以尝试将此 JSON 编写为对象列表:
You can also try this JSON written as a list of objects:
它可以通过您在问题中发布的链接以 HTML 形式提供:) 说真的,如果维基百科中的列表完整,那么使用 lxml.html(Python)或任何您喜欢的语言的类似库。
It is available in HTML via the link you have posted in your question :) Seriously, if that list in Wikipedia is complete, than it is easy to grab it using lxml.html (in Python) or any similar library in your favorite language.
这是 Groovy 中的一个小脚本,它打印一个 JSON,其中包含所有语言代码及其母语、英语和葡萄牙语名称。
$
groovy langs2json.groovy >语言.json
Here's a small script in Groovy that prints a JSON with all languages codes with their native, English and Portuguese names.
$
groovy langs2json.groovy > languagess.json
此 PHP 函数将使用美国国会图书馆数据文件将语言代码转换为语言名称:
This PHP function will convert the language code to the language name, using the Library of Congress data file:
这段小代码可以帮助构建一个数组,使用 2 个字母代码“iso639-1”作为“键”,使用语言名称作为“值”,从以下位置获取数据: gov/standards/iso639-2/ISO-639-2_utf-8.txt" rel="nofollow">http://loc.gov/standards/iso639-2/ISO-639-2_utf-8.txt
This small code can help to build an array, using the 2 letter code "iso639-1" as the 'key' and the language name as the 'value' getting data from: from http://loc.gov/standards/iso639-2/ISO-639-2_utf-8.txt
我已将 'Instine' 答案 转换为 C# 格式
I've converted 'Instine' answer to C# format