• Stars
    star
    114
  • Rank 308,031 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 10 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

ISO 639-1/2/3 Language codes with English and local names

Langs

Langs

Master branch build status Published version MIT Licensed

$ npm install langs

This library provides ISO 639-1/2/3 language codes with English and local names. It can be installed in whichever way you prefer, but I recommend NPM.

What's with all the ISO version numbers?

ISO 639 is broken up into many different parts, each either defining language codes or defining standards for codes in later versions. The ones included in this library are:

  • ISO 639-1 2 characters, one per language or ISO 639 macrolanguage
  • ISO 639-2/2T 3 characters, one per language
  • ISO 639-2B 3 characters, mostly the same as 639-2T but with some derived from their English name rather than local name
  • ISO 639-3 3 characters, mostly the same as 639-2T but using the canonical ISO 639 macrolanguage code

The macrolanguages described above cover cases where a language is considered to be a dialect of another in some standards but not in others, e.g Standard Arabic arb and Arabic ara. There's more information on the Wikipedia page.

Documentation

var langs = require('langs');

langs.all();
// [
//     {"name":"English", "local":"English", "1":"en", "2":"eng", "2T":"eng", "2B":"eng", "3":"eng"},
//     {"name":"Korean", "local":"ํ•œ๊ตญ์–ด", "1":"ko", "2":"kor", "2T":"kor", "2B":"kor", "3":"kor"},
//     ...
// ]

langs.names();
// [
//     "English",
//     "Korean",
//     ...
// ]

langs.names(true);
// [
//     "English",
//     "ํ•œ๊ตญ์–ด",
//     ...
// ]

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

langs.codes("2T" /*same as "2"*/);
// [
//     "eng",
//     "kor",
//     ...
// ]

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

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

langs.where("name", "Korean");
// {"name":"Korean", "local":"ํ•œ๊ตญ์–ด", "1":"ko", "2":"kor", "2T":"kor", "2B":"kor", "3":"kor"}

langs.where("local", "ํ•œ๊ตญ์–ด, ์กฐ์„ ์–ด");
// {"name":"Korean", "local":"ํ•œ๊ตญ์–ด", "1":"ko", "2":"kor", "2T":"kor", "2B":"kor", "3":"kor"}

langs.where("1", "ko");
// {"name":"Korean", "local":"ํ•œ๊ตญ์–ด", "1":"ko", "2":"kor", "2T":"kor", "2B":"kor", "3":"kor"}

langs.where("2", "kor");
// {"name":"Korean", "local":"ํ•œ๊ตญ์–ด", "1":"ko", "2":"kor", "2T":"kor", "2B":"kor", "3":"kor"}

langs.where("2T", "kor");
// {"name":"Korean", "local":"ํ•œ๊ตญ์–ด", "1":"ko", "2":"kor", "2T":"kor", "2B":"kor", "3":"kor"}

langs.where("2B", "kor");
// {"name":"Korean", "local":"ํ•œ๊ตญ์–ด", "1":"ko", "2":"kor", "2T":"kor", "2B":"kor", "3":"kor"}

langs.where("3", "kor");
// {"name":"Korean", "local":"ํ•œ๊ตญ์–ด", "1":"ko", "2":"kor", "2T":"kor", "2B":"kor", "3":"kor"}

langs.has("name", "Korean");
// true

langs.has("local", "ํ•œ๊ตญ์–ด, ์กฐ์„ ์–ด");
// true

langs.has("1", "ko");
// true

langs.has("2", "kor");
// true

langs.has("2T", "kor");
// true

langs.has("2B", "kor");
// true

langs.has("3", "kor");
// true

langs.has("name", "Geordie");
// false

langs.has("high", "fives");
// false

Contributing

I accept contributions to the source via Pull Request, but passing unit tests must be included before it will be considered for merge.

$ curl -O https://raw.githubusercontent.com/adlawson/vagrantfiles/master/nodejs/Vagrantfile
$ vagrant up
$ vagrant ssh
$ cd /srv

$ npm test

License

The content of this library is released under the MIT License by Andrew Lawson.
You can find a copy of this license in LICENSE or at http://www.opensource.org/licenses/mit.

More Repositories

1

php-vfs

Virtual File System
PHP
299
star
2

vagrantfiles

A Virtual Machine for every language
Ruby
230
star
3

search-algorithms

Search algorithms implemented in different languages
Elixir
71
star
4

mixcloud-tracklist

[Unofficial] Display tracklists on Mixcloud
JavaScript
48
star
5

sweetjs-pipeline

Naturally expressive functional composition
JavaScript
26
star
6

nodejs-wesley

๐Ÿšจ [UNMAINTAINED] Protocol compliant web socket server with some awesome extras.
JavaScript
23
star
7

nodejs-urine

Sample a stream
JavaScript
9
star
8

docker-dat

Dat server in Docker
Shell
9
star
9

nodejs-throb

๐Ÿšจ [UNMAINTAINED] Lightweight heartbeat and ping server
JavaScript
7
star
10

php-veval

Virtual metaprogramming
PHP
6
star
11

scala-cats

Cats extended
Scala
5
star
12

js-defur

๐Ÿšจ [UNMAINTAINED] Defer construction or execution of a service until it's needed
JavaScript
4
star
13

php-mustache

๐Ÿšจ [UNMAINTAINED] PHP5.3+ Mustache implementation. Still currently in development.
PHP
4
star
14

coffee-key

๐Ÿšจ [UNMAINTAINED] A tiny little keycode library
CoffeeScript
4
star
15

php-timezone

UTC default timezone
PHP
3
star
16

elixir-pnum

Concurrent list enumeration
Elixir
2
star
17

php-restack

๐Ÿšจ [UNMAINTAINED] PHP 5.3+ datastructure library
PHP
2
star
18

adlawson.github.io

Website
HTML
2
star
19

dotfiles

~
Emacs Lisp
2
star
20

dockerfiles

๐Ÿณ
Dockerfile
2
star
21

scala-json4s

Serializers, formatters and other useful extensions for JSON4S in Scala
Scala
2
star
22

behat-parallel

Parallel Behat processes
Shell
2
star
23

nodejs-conway

Rendering agnostic implementation of Conway's Game of Life in JavaScript
JavaScript
2
star
24

php-reform

๐Ÿšจ [UNMAINTAINED] PHP 5.3+ form library
PHP
1
star
25

js-zcombinator

Z Combinator for self-referencing anonymous functions
JavaScript
1
star
26

howlonguntilourholiday.com

๐Ÿšจ [UNMAINTAINED] How long until our holiday?
CoffeeScript
1
star