Socket
Socket
Sign inDemoInstall

list-of-iso-language-codes-with-translations

Package Overview
Dependencies
7
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    list-of-iso-language-codes-with-translations

List of iso 639-1, 639-2T, 639-2B, 639-3 codes with their translations in any langauge


Version published
Maintainers
1
Created

Readme

Source

List of ISO 639-1, 639-2T, 639-2B and 639-3 codes with translations in all available languages.

Sometimes you need to get a fresh list of 639-1, 639-2T, 639-2B or 639-3 language codes and their translations. Until now there was not an easy way to get them.

All data are available in json format in data/[language]/639-1.json. More formats might be available in the future.

Usage

  1. JS functions (with TS type definitions included)
  2. Directly, using files located in data folder

JS functions

FunctionArgumentsReturn valueExample usage
getEnglishName(code: string)language code`stringnull`
getName(code: string, language = 'en')from language, to language?`stringnull`
isValid(code: string, availableIsoTypes?: IsoType[], moreInfo = false)language code, IsoType (below table), moreInfo`boolean{ iso: IsoType
getIsoCodesFromNativeName(nativeName: string, normalizeString = false)language name, should normalize string (lowercase and remove diacritics)`IsoType[]null`
getAll639_1()Xstring[] (639-1 list)getAll639_1() => ['aa', 'ab', 'af'...]
getAll639_2B()Xstring[] (639-2B list)getAll639_2B() => ['aar', 'abk', 'ace'...]
getAll639_2T()Xstring[] (639-2T list)getAll639_2T() => ['aar', 'abk', 'ace'...]
getAll639_3()Xstring[] (639-3 list)getAll639_3() => ['aaa', 'aab', 'aac'...]

type IsoType = "639-1" | "639-2B" | "639-2T" | "639-3"

File format

If you have some ideas (csv, another JSON format...) let me know or create PR.

Adding more languages

Language matrix is generated by Node.js Intl API (version 17.1.0). If you would like to edit something, Create PR in Node.js Intl API. Wait before release and run yarn generate.

Tests

There are jest tests which tests basic functionality. Feel free to extend them.

More info

Getting the list of all available languages is from official list

Keywords

FAQs

Last updated on 14 Nov 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc