Socket
Socket
Sign inDemoInstall

@phensley/language-tag

Package Overview
Dependencies
1
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @phensley/language-tag

Parsing and construction of BCP 47 language tags


Version published
Weekly downloads
2.5K
decreased by-7.01%
Maintainers
1
Install size
216 kB
Created
Weekly downloads
 

Changelog

Source

[1.8.0]

Fixed/Changed

  • Upgrade to CLDR v44
  • Upgrade to Typescript 5.3.2
  • Created LocaleResolver class to split a merged declaration with the Locale interface.

Readme

Source

@phensley/language-tag

@phensley/language-tag min+gzip

Implements BCP 47 language tag parsing and construction.

Installation

NPM:

npm install --save @phensley/language-tag

Yarn:

yarn add @phensley/language-tag

Examples

const IDS = ['en', 'es', 'es-419', 'und-AR', 'und-Hant', 'iw', 'i-klingon'];
for (const id of IDS) {
  const tag = parseLanguageTag(id);
  console.log(`${tag.compact().padStart(10)}  ${tag.expanded()}`);
}
        en  en-Zzzz-ZZ
        es  es-Zzzz-ZZ
    es-419  es-Zzzz-419
    und-AR  und-Zzzz-AR
  und-Hant  und-Hant-ZZ
        iw  iw-Zzzz-ZZ
       tlh  tlh-Zzzz-ZZ
const t = new LanguageTag(undefined, 'latn', 'us', 'PoSiX', {
  u: ['ca-gregory']
});
console.log(t.expanded());
und-Latn-US-posix-u-ca-gregory

FAQs

Last updated on 21 Nov 2023

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