Skip to content

sanishmaharjan/i18n-iso-639-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

I18N ISO 639-1

NPM Version Build Status Download Count

JavaScript utilities for ISO-639-1 language codes

Installation

npm install i18n-iso-639-1

Usage

const i18nIsoCodes = require('i18n-iso-639-1');

console.log(i18nIsoCodes.getName('zh')) // 'Chinese'
console.log(i18nIsoCodes.getNativeName('zh')) // '中文'

console.log(i18nIsoCodes.getAllNames()) // ['Afar','Abkhaz', ... ,'Zulu']
console.log(i18nIsoCodes.getAllNativeNames()) //['Afaraf','аҧсуа бызшәа', ... ,'isiZulu' ]

console.log(i18nIsoCodes.getCode('Chinese')) // 'zh'
console.log(i18nIsoCodes.getCode('中文')) // 'zh'

console.log(i18nIsoCodes.getAllCodes()) //['aa','ab',...,'zu']

console.log(i18nIsoCodes.validate('en')) // true
console.log(i18nIsoCodes.validate('xx')) // false

console.log(i18nIsoCodes.getLanguages(['en', 'zh']))
// [{code:'en',name:'English',nativeName:'English'},{code:'zh',name:'Chinese',nativeName:'中文'}]

About

JavaScript utilities for ISO-639-1 codes

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published