npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

iso-639-language

v1.0.1

Published

A package which lookup for the language name for a given locale ISO-639-1 or, 639-2 /B, 639-3 and return the correct name in English German, French,Italian,Albanian

Downloads

289

Readme

ISO-639-LANGUAGE

npm npm collaborators NPM npm npm bundle size

Simple interface for iso-639-language language codes

Installation

npm i iso-639-language

Usage Javascript

Node.js

const Iso639Type = require('iso-639-language');
//  ISO_639_1 = 1,
//  ISO_639_2 = 2,
//  ISO_639_3 = 3
const iso639_1 = Iso639Type.getType(1); 
console.log(iso639_1.getNameByCodeEnglish('en')); // 'English'
console.log(iso639_1.getNameByCodeGerman('en')); // 'Englisch'
console.log(iso639_1.getNameByCodeFrench('en')); // 'Anglais'
console.log(iso639_1.getNameByCodeItalian('en')); // 'Inglese'
console.log(iso639_1.getNameByCodeAlbanian('en')); // 'Anglisht'
// Accept 2 params, code: string, translate:"en"|"de"|"fr"|"it"
console.log(iso639_1.getNameByCodeTranslate('de','en')); // 'German'

ES Module

import Iso639Type from 'iso-639-language';
//  ISO_639_1 = 1,
//  ISO_639_2 = 2,
//  ISO_639_3 = 3
const iso639_1 = Iso639Type.getType(1); 
console.log(iso639_1.getNameByCodeEnglish('en')); // 'English'
console.log(iso639_1.getNameByCodeGerman('en')); // 'Englisch'
console.log(iso639_1.getNameByCodeFrench('en')); // 'Anglais'
console.log(iso639_1.getNameByCodeItalian('en')); // 'Inglese'
console.log(ISO6391.getNameByCodeAlbanian('en')); // 'Anglisht'
// Accept 2 params, code: string, translate:"en"|"de"|"fr"|"it"|"al"
console.log(iso639_1.getNameByCodeTranslate('de','en')); // 'German'

Usage TypeScript

    import Iso639Type,{Language,IsoType} from 'iso-639-language';
    //  ISO_639_1, ISO_639_2, ISO_639_3
    const iso639_1 = Iso639Type.getType(IsoType.ISO_639_1); 
    let language:Language;
    language=iso639_1.getFullLanguageByCode('en');
    console.log(language);
    /*
    {
        al: "Anglisht"
        de: "Englisch"
        en: "English"
        familyName: "Indo-European"
        fr: "anglais"
        iso639_1: "en"
        iso639_2: "eng"
        iso639_3: "eng"
        it: "Inglese"
        name: "English"
        nativeName: "English"
        wikiUrl: "https://en.wikipedia.org/wiki/English_language" 
     }
     */

Methods

getNameByCode(code: string): string;

  • @param code {string}
  • @return {string}

Get name by code

getNameAll(): Array;

  • @return {array}

Get array of all language names

getNameByCodeNative(code: string): string;

  • @param code {string}
  • @return {string}

Get language native name by code

getNameByCodeEnglish(code: string): string;

  • @param code {string}
  • @return {string}

Get name in English by code

getNameByCodeGerman(code: string): string;

  • @param name {string}
  • @return {string}

Get name in German by code

getNameByCodeFrench(code: string): string;

  • @param name {string}
  • @return {array}

Get name in French by code

getNameByCodeItalian(code: string): string;

  • @param name {string}
  • @return {array}

Get name in Italian by code

getNameByCodeAlbanian(code: string): string;

  • @param name {string}
  • @return {array}

Get name in Albanian by code

getNameByCodeTranslate(code: string,translate:string): string;

  • @param name {string}
  • @param translate {string} |"en"|"de"|"fr"|"it"|"al"
  • @return {array}

Get name by code and Language // default is "en"

getCodeByName(name: string): string;

  • @param name {string}
  • @return {boolean}

Get Code by name

getCodeAll(): Array;

  • @return {array}

Get the array of Code

checkExist(code: string): boolean;

  • @param code {string}
  • @return {array}

Check if exist a specific Code

getFullLanguageByCode(code: string): Language;

  • @param code {string}
  • @return {Object} Language

Get all properties of language by Code

getFullLanguageByName(name: string): Language;

  • @param name {string}
  • @return {Object} Language

Get all properties of language by Name

getFullLanguageAll(): Array;

  • @return {array}

Get array of all properties of language

More Info

Language

class Language {
    name = '';
    iso639_1 = '';
    iso639_2 = '';
    iso639_3 = '';
    familyName = '';
    nativeName = '';
    en = '';
    it = '';
    fr = '';
    al = '';
    de = '';
    wikiUrl = '';
}

IsoType

enum IsoType {
  ISO_639_1 = 1,
  ISO_639_2 = 2,
  ISO_639_3 = 3
}