Gathering detailed insights and metrics for wikidata-lang
Gathering detailed insights and metrics for wikidata-lang
Gathering detailed insights and metrics for wikidata-lang
Gathering detailed insights and metrics for wikidata-lang
A database of languages and their Wikidata id, Wikimedia language code, ISO 639-1, ISO 639-2, ISO 639-3, ISO 639-6 codes
npm install wikidata-lang
Typescript
Module System
Min. Node Version
Node Version
NPM Version
81.7
Supply Chain
99.6
Quality
77.9
Maintenance
100
Vulnerability
100
License
JavaScript (96.68%)
Shell (3.32%)
Total Downloads
451,972
Last Day
11
Last Week
262
Last Month
1,967
Last Year
14,354
16 Stars
75 Commits
1 Forks
4 Watchers
2 Branches
1 Contributors
Updated on Apr 28, 2025
Minified
Minified + Gzipped
Latest Version
5.0.0
Package Id
wikidata-lang@5.0.0
Unpacked Size
1.23 MB
Size
263.55 kB
File Count
75
NPM Version
10.9.2
Node Version
22.14.0
Published on
Apr 28, 2025
Cumulative downloads
Total Downloads
A database of languages and their wikidata id, Wikimedia language code, ISO 639-1, ISO 639-2, ISO 639-3, and ISO 639-6 codes. A database of languages and their Wikidata id, Wikimedia language code, ISO 639-1, ISO 639-2, ISO 639-3, ISO 639-6 codes
This database is based on the result of a SPARQL query executed on query.wikidata.org, so the data is as good as Wikidata is: in case of an error, please update Wikidata and request an update of this database in the issues.
For each language, the data object looks like this:
1{ 2 wd: 'Q8798', // https://wikidata.org/entity/Q8798 3 label: 'Ukrainian', // English label 4 native: 'українська мова', // P1705 5 wmCode: [ 'uk' ], // P424 6 iso6391: [ 'uk' ], // P218 7 iso6392: [ 'ukr' ], // P219 8 iso6393: [ 'ukr' ] // P220 9 // iso6396 value (P221) missing for Q8798 10}
From a terminal, in your project directory, run:
1npm install wikidata-lang
In your JS code:
1// languages indexed by Wikidata id is the default 2const languagesByWdId = require('wikidata-lang') 3 4// For indexes by other available codes, require the desired module: 5const languagesByIso6391Code = require('wikidata-lang/indexes/by_iso_639_1_code') 6const languagesByIso6392Code = require('wikidata-lang/indexes/by_iso_639_2_code') 7const languagesByIso6393Code = require('wikidata-lang/indexes/by_iso_639_3_code') 8const languagesByIso6396Code = require('wikidata-lang/indexes/by_iso_639_6_code') 9const languagesByWmCode = require('wikidata-lang/indexes/by_wm_code') 10// Note that you can also use an index regrouping all of the above 11const languagesByAnyCode = require('wikidata-lang/indexes/by_any_code') 12 13// The Wikidata id index returns single language data objects 14languagesByWdId.Q8798 15// => { "code": "uk", "label": "Ukrainian", "native": "Українська", "wd": "Q8798" } 16 17// while indexes by code always return arrays of language data objects 18// to account for edge cases where several Wikidata languages items share a common code. 19languagesByIso6391Code.uk[0] 20// => { "code": "uk", "label": "Ukrainian", "native": "Українська", "wd": "Q8798" }
Conversion mappings can be build from the language data objects described above, but you can also use the pre-built ones:
1const wdIdByWmCode = require('wikidata-lang/mappings/wd_id_by_wm_code.json') 2wdIdByWmCode['zh-min-nan'] // => 'Q36495' 3 4const wdIdByIso6391Code = require('wikidata-lang/mappings/wd_id_by_iso_639_1_code.json') 5wdIdByIso6391Code['cr'] // => 'Q33390' 6 7const wdIdByIso6392Code = require('wikidata-lang/mappings/wd_id_by_iso_639_2_code.json') 8wdIdByIso6392Code['kzu'] // => 'Q6380723' 9 10const wdIdByIso6393Code = require('wikidata-lang/mappings/wd_id_by_iso_639_3_code.json') 11wdIdByIso6393Code['acc'] // => 'Q16110361' 12 13const wdIdByIso6396Code = require('wikidata-lang/mappings/wd_id_by_iso_639_6_code.json') 14wdIdByIso6396Code['jah'] // => 'Q2742661' 15 16const wmCodeByWdId = require('wikidata-lang/mappings/wm_code_by_wd_id.json') 17wmCodeByWdId['Q32762'] // => 'fiu-vro' 18 19// This one seems useless, as ISO 639-1 seem to always be equivalent to their corresponding Wikimedia language code 20const wmCodeByIso6391Code = require('wikidata-lang/mappings/wm_code_by_iso_639_1_code.json') 21wmCodeByIso6391Code['id'] // => 'id' 22 23const wmCodeByIso6392Code = require('wikidata-lang/mappings/wm_code_by_iso_639_2_code.json') 24wmCodeByIso6391Code['zza'] // => 'diq' 25 26const wmCodeByIso6393Code = require('wikidata-lang/mappings/wm_code_by_iso_639_3_code.json') 27wmCodeByIso6391Code['yue'] // => 'zh-yue' 28 29const wmCodeByIso6396Code = require('wikidata-lang/mappings/wm_code_by_iso_639_6_code.json') 30wmCodeByIso6391Code['yyef'] // => 'zh-yue' 31 32// etc.
See the mappings
folder for a full list of available mappings.
NB: When several values are available for a given key, no value is added to the mapping for that key. It is added instead to the mappings/x_by_x.multiple_values.json
file.
For instance, in ISO 639-2, both ell
and gre
are mapped to el
in ISO 639-1 (also true for Wikimedia language codes)
See how we use it in Inventaire
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
8 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 6
Reason
6 existing vulnerabilities detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreLast Day
-31.3%
11
Compared to previous day
Last Week
-67.4%
262
Compared to previous week
Last Month
-12.4%
1,967
Compared to previous month
Last Year
-74.8%
14,354
Compared to previous year