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.
npm install --save iso-language-converter
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
Type: string
The code of the language in one of the ISO 639 form -or- the English name for the language.
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
}
MIT