Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

iso-lang-codes

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iso-lang-codes

Node util for ISO Language Codes (639-1 and 693-2) and IETF Language Types

  • 2.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.8K
decreased by-61.3%
Maintainers
2
Weekly downloads
 
Created
Source

Cloudoki JavaScript Style Guide

ISO Language Codes

Node util for ISO Language Codes (639-1 and 693-2) and IETF Language Types

Created using the data from https://datahub.io/core/language-codes.

Use this util to get and validate the languages codes, countries and languages names.


Usage

Install the latest version:

npm i --save iso-lang-codes@latest

Require the module in your code & start using:

const codes = require('iso-lang-codes')

codes.validateLocaleCode('pt-PT')


Documentation

validateLocaleCode

Takes a locale code and checks if exists in the data dictionary

Parameters

  • localeCode string Language code (e.g. "en-GB")

Returns boolean

validateLanguageCode

Takes a language code and checks if exists in the data dictionary

Parameters

  • languageCode string Language code (e.g. "en")

Returns boolean

findCountryLanguages

Takes a country code and returns the list of languages valid for it

Parameters

  • countryCode string Country code (e.g. "PT")

Returns Array<string> Languages list

findCountryLocales

Takes a country code and returns the list of locales valid for it

Parameters

  • countryCode string Country code (e.g. "PT")

Returns Array<string> Locales list

locales

Returns a list with a map of all existing locale codes and the respective country+countryCode

Returns Object Locales list in the form of a map: ['pt-PT'] => 'Portuguese (PT)'

Keywords

FAQs

Package last updated on 29 Apr 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc