BCP47 picker

A customElement to input one or multiple BCP47 language codes.
GitHub | NPM

Features

Installation

npm install bcp47-picker --save

Example code:


import 'bcp47-picker'


<bcp47-picker value="fr,de" multiple></bcp47-picker>

Demo:

Please select a language
This example uses the ROLV dataset.
This example uses the ISO 639-3 dataset.
This example force a canonical.

Creating your own languages index JSON

It is possible to create your own data file. Why would you do this? Within the BCP47 there are multiple ways to arrive at a language. Organizations can have different preferred language codes.

Data format of the JSON
The JSON file MUST be an array with the following structure:
      
[
  ["BCP47-CODE", 
    ["LABEL", 
      [
        "Alternative name 1", 
        "Alternative name 2"
      ]
    ]
  ]
]