npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

language-code-russian-names

v1.0.3

Published

Small library for getting russian names of languages by their ISO 639-3 code (also by few another).

Downloads

6

Readme

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

  1. 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"}) in langs.ruNames, you get string with two languages - Молдавский, Румынский (Moldavian, Romanian). For {"ron": "Romanian"} of Romania country you get just Румынский (Romanian). If you pass just a string ron you also get only Румынский.
  2. langs.originalNames working properly only if you're using meldoze package or passing identical objects (see above). Doesn't work with strings.
  3. Some russian names of rare languages taken from here, some from their pages on Wikipedia.
  4. 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 replace test/countries/countries.json with new.
  5. When langs.alpha2 codes was multiple, i prefer ISO-639-2/B.

Documentation

var langs = require('lang-codes-ru-names');

langs.ruNames({"ara": "Arabic"});
// "Арабский"

langs.ruNames({"cat":"Catalan","eus":"Basque","glg":"Galician","oci":"Occitan","spa":"Spanish"});
// "Каталанский, Баскский, Галисийский, Окситанский, Испанский"

langs.ruNames("ara");
// "Арабский"

langs.originalNames({"cat":"Catalan","eus":"Basque","glg":"Galician","oci":"Occitan","spa":"Spanish"});
// "Catalan, Basque, Galician, Occitan, Spanish"

langs.all();
// [
//     {"name":"Английский","1":"en","2":"eng","3":"eng","gost77597":"анг","numeric":45},
//     {"name":"Корейский","1":"ko","2":"kor","3":"kor","gost77597":"коо","numeric":330},
//     ...
// ]

langs.names();
// [
//     "Английский",
//     "Корейский",
//     ...
// ]

langs.codes("1");
// [
//     "en",
//     "ko",
//     ...
// ]

langs.codes("2");
// [
//     "eng",
//     "kor",
//     ...
// ]


langs.codes("3");
// [
//     "eng",
//     "kor",
//     ...
// ]

langs.codes("gost77597");
// [
//     "анг",
//     "коо",
//     ...
// ]

langs.codes("numeric");
// [
//     45,
//     330,
//     ...
// ]

langs.alpha1("en");
// {
//  '1': 'en',
//  '2': 'eng',
//  '3': 'eng',
//  name: 'Английский',
//  gost77597: 'анг',
//  numeric: 45
// }

langs.alpha2("eng");
// {
//  '1': 'en',
//  '2': 'eng',
//  '3': 'eng',
//  name: 'Английский',
//  gost77597: 'анг',
//  numeric: 45
// }

langs.alpha3("eng");
// {
//  '1': 'en',
//  '2': 'eng',
//  '3': 'eng',
//  name: 'Английский',
//  gost77597: 'анг',
//  numeric: 45
// }

langs.gost77597("анг");
// {
//  '1': 'en',
//  '2': 'eng',
//  '3': 'eng',
//  name: 'Английский',
//  gost77597: 'анг',
//  numeric: 45
// }

langs.numeric("45");
// {
//  '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

  • [x] 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)
  • [x] ~~Reduce all 639-2 codes to one standard (2B or 2T)~~ (i took 2B)
  • [ ] Refactor code
  • [ ] Refactor tests