Description
I made this package for working with countries data by meldoze. They are using languages object keyed by ISO 639-3
three-letter codes and values with name of the language in English, like so:
"languages": "fra": "French" "mlg": "Malagasy"
For my own needs i want to get language name(s) by code on Russian, returned as strings. Codes and names taken from Wikipedia.
Installation
npm install language-code-russian-names
or
yarn add language-code-russian-names
Notes
- Language with code
mol
is Moldavian, but this code is retired by merge with Romanian language. So, if you using meldoze database and pass languages object of Moldova country ({"ron": "Moldavian"}
) inlangs.ruNames
, you get string with two languages -Молдавский, Румынский
(Moldavian, Romanian). For{"ron": "Romanian"}
of Romania country you get justРумынский
(Romanian). If you pass just a stringron
you also get onlyРумынский
. langs.originalNames
working properly only if you're using meldoze package or passing identical objects (see above). Doesn't work with strings.- Some russian names of rare languages taken from here, some from their pages on Wikipedia.
- Folder
test
contains folder with json dataset of meldoze countries and licence file. If you want to run tests on more fresh dataset - download it from here and replacetest/countries/countries.json
with new. - When
langs.alpha2
codes was multiple, i preferISO-639-2/B
.
Documentation
var langs = ; langs;// "Арабский" langs;// "Каталанский, Баскский, Галисийский, Окситанский, Испанский" langs;// "Арабский" langs;// "Catalan, Basque, Galician, Occitan, Spanish" langsall;// [// {"name":"Английский","1":"en","2":"eng","3":"eng","gost77597":"анг","numeric":45},// {"name":"Корейский","1":"ko","2":"kor","3":"kor","gost77597":"коо","numeric":330},// ...// ] langs;// [// "Английский",// "Корейский",// ...// ] langs;// [// "en",// "ko",// ...// ] langs;// [// "eng",// "kor",// ...// ] langs;// [// "eng",// "kor",// ...// ] langs;// [// "анг",// "коо",// ...// ] langs;// [// 45,// 330,// ...// ] langs;// {// '1': 'en',// '2': 'eng',// '3': 'eng',// name: 'Английский',// gost77597: 'анг',// numeric: 45// } langs;// {// '1': 'en',// '2': 'eng',// '3': 'eng',// name: 'Английский',// gost77597: 'анг',// numeric: 45// } langs;// {// '1': 'en',// '2': 'eng',// '3': 'eng',// name: 'Английский',// gost77597: 'анг',// numeric: 45// } langs;// {// '1': 'en',// '2': 'eng',// '3': 'eng',// name: 'Английский',// gost77597: 'анг',// numeric: 45// } langs;// {// '1': 'en',// '2': 'eng',// '3': 'eng',// name: 'Английский',// gost77597: 'анг',// numeric: 45// }
Tests
npm run test
Links
currency-names - another library for working with meldoze database for getting currency names by currency code(s). Names available on Russian and English. 184 currency codes in total.
Todo
- Add npm and yarn install commands in README
- Ability to pass an array of iso 639-3 codes and get string with russian names
- Ability to use in browser
- Add English names for every language
- Add
639-1
for languages that missing it (if code exists) - Add
639-2B
for languages that missing it (if code exists) -
Reduce all(i took639-2
codes to one standard (2B or 2T
)2B
) - Refactor code
- Refactor tests