You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

language-subtag-registry

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

language-subtag-registry

Full BCP 47 language subtag data from the official IANA repository, in JSON format with multiple indices.

0.3.23
latest
Source
npmnpm
Version published
Weekly downloads
14M
-17.5%
Maintainers
1
Weekly downloads
 
Created

What is language-subtag-registry?

The language-subtag-registry npm package provides an interface to access and manipulate data from the IANA Language Subtag Registry. This registry contains codes that are used to identify human languages, scripts, countries, and variants. The package allows for searching, validating, and parsing these codes, making it useful for applications that need to handle language tags according to the IETF BCP 47 standard.

What are language-subtag-registry's main functionalities?

Searching for language subtags

This feature allows users to search the registry for specific subtags. In the code sample, the search function is used to find entries related to the 'en' subtag, which typically corresponds to English.

const { search } = require('language-subtag-registry');
const results = search('en');
console.log(results);

Validating language subtags

This feature enables the validation of language subtags to ensure they conform to the IETF BCP 47 standard. The code sample demonstrates validating the 'en-US' language tag, which represents English as used in the United States.

const { validate } = require('language-subtag-registry');
const isValid = validate('en-US');
console.log(isValid);

Parsing language subtags

This feature provides the ability to parse complex language tags into their constituent parts, such as language, script, and region. The code sample parses 'zh-Hant-HK', which represents Chinese written in the Traditional script as used in Hong Kong.

const { parse } = require('language-subtag-registry');
const parsed = parse('zh-Hant-HK');
console.log(parsed);

Other packages similar to language-subtag-registry

Keywords

iana

FAQs

Package last updated on 21 May 2024

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