The IANA Language Subtag Registry is a long text file that contains a list of all the language subtags that are used in the IETF BCP 47 standard.
This parser parses the IANA Language Subtag Registry and generates JSON objects that can be used for further processing.
$ pnpm install #to install dependencies
$ pnpm start #to start the script
$ pnpm start:stdout #to write the output to stdout
Input:
File-Date: 2021-08-06
%%
Type: language
Subtag: aa
Description: Afar
Added: 2005-10-16
%%
Type: language
Subtag: ab
Description: Abkhazian
Added: 2005-10-16
Suppress-Script: Cyrl
Output:
[
{
"fileDate": "2021-08-06"
},
{
"type": "language",
"subtag": "aa",
"description": "Afar",
"added": "2005-10-16"
},
{
"type": "language",
"subtag": "ab",
"description": "Abkhazian",
"added": "2005-10-16",
"suppressScript": "Cyrl"
}
]