0.0.3 • Published 3 years ago

ts-extended-language-list v0.0.3

Weekly downloads
-
License
BSD
Repository
github
Last release
3 years ago

Project forked from "language-list" @pandeysoni

ts-extended-language-list

Map Stores ISO 639-1 language codes to language names and vice versa. Made in Typescript.

npm package version number License

Supported languages:

en
ar
it

Example of use

const languages = require('ts-extended-language-list');

console.log(languages.getLanguageName('it', 'ar')); // إيطالي
console.log(languages.getLanguageCode('Italian', 'en')); // it
console.log(languages.getLanguageName('en', 'it')); // Inglese

How to import

const languages = require('ts-extended-language-list');

or

import {ExtendedLanguageList} from 'ts-extended-language-list';

Methods

All input is case-insensitive.

getLanguageName(languageCode, requiredLanguage)

Expects a language code, and the desired language. Returns the language name for that language code in the desired language. If not found, it returns undefined.

getLanguageCode(languageName, requiredLanguage)

Expects the language name, and the desired language. Returns the language code for that language in the desired language. If not found, it returns undefined.

getLanguageNames(requiredLanguage)

Returns an array of all language names in the desired language.

getLanguageCodes(requiredLanguage)

Returns an array of all language codes in the desired language.

getData(requiredLanguage)

Returns an array of all language information in the desired language, in the same format as it gets imported.