Not Providing Milkshakes

    @phensley/language-tag
    TypeScript icon, indicating that this package has built-in type declarations

    1.5.0 • Public • Published

    @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
    

    Keywords

    none

    Install

    npm i @phensley/language-tag

    DownloadsWeekly Downloads

    1,908

    Version

    1.5.0

    License

    Apache-2.0

    Unpacked Size

    135 kB

    Total Files

    39

    Last publish

    Collaborators

    • phensley