1.1.0 • Published 7 years ago

iso-language-converter v1.1.0

Weekly downloads
1,148
License
MIT
Repository
github
Last release
7 years ago

iso-language-converter Build Status

Converter between different ISO 639 language tags.

The list of codes is taken by Wikipedia, while the default scripts for each language is taken from this table.

Install

npm install --save iso-language-converter

Usage

var isoConv = require('iso-language-converter');

isoConv('ita'); // Italian
isoConv('it'); // Italian
isoConv('Italian'); // it

isoConv('it', {from: 1, to: 'label'}); // Italian
isoConv('ita', {from: 2, to: 1}); // it

isoConv('it', {from: 'label'}); // Italian
isoConv('ita', {from: 1}); // it

isoConv('it', {to: 'script'}); // 'Latn'
isoConv('ho', {to: 'script'}); // undefined

API

isoConv(input, options)

input

Type: string

The code of the language in one of the ISO 639 form -or- the English name for the language.

options

Type: object

Options for the converter:

{
  // number of ISO 639 from 1 to 5, or 'label'
  // if not specified, guess on the input
  from: 1,

  // number of ISO 639 from 1 to 5, 'label' or 'script'
  // if not specified, guess on the input
  to: 'label',

  // return an ISO 639-5 if the requested ISO is not present (not valid with to:'label')
  // default: false
  fallback: false
}

License

MIT

1.1.0

7 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago