php language-subtag-registry.php > language-subtag-registry.json
This produces all grandfathered tags, with or without a preferredValue
, and includes all redundant tags that have a preferredValue
.
cat language-subtag-registry.json \
| jq '
.records[]
| select((.type == "redundant" and has("preferredValue")) or .type == "grandfathered")
| {(.tag): .preferredValue?}
' \
| jq -s -S add
Produces:
{
"art-lojban": "jbo",
"cel-gaulish": null,
"en-GB-oed": "en-GB-oxendict",
"i-ami": "ami",
"i-bnn": "bnn",
"i-default": null,
"i-enochian": null,
"i-hak": "hak",
"i-klingon": "tlh",
"i-lux": "lb",
"i-mingo": null,
"i-navajo": "nv",
"i-pwn": "pwn",
"i-tao": "tao",
"i-tay": "tay",
"i-tsu": "tsu",
"no-bok": "nb",
"no-nyn": "nn",
"sgn-BE-FR": "sfb",
"sgn-BE-NL": "vgt",
"sgn-BR": "bzs",
"sgn-CH-DE": "sgg",
"sgn-CO": "csn",
"sgn-DE": "gsg",
"sgn-DK": "dsl",
"sgn-ES": "ssp",
"sgn-FR": "fsl",
"sgn-GB": "bfi",
"sgn-GR": "gss",
"sgn-IE": "isg",
"sgn-IT": "ise",
"sgn-JP": "jsl",
"sgn-MX": "mfs",
"sgn-NI": "ncs",
"sgn-NL": "dse",
"sgn-NO": "nsl",
"sgn-PT": "psr",
"sgn-SE": "swl",
"sgn-US": "ase",
"sgn-ZA": "sfs",
"zh-cmn": "cmn",
"zh-cmn-Hans": "cmn-Hans",
"zh-cmn-Hant": "cmn-Hant",
"zh-gan": "gan",
"zh-guoyu": "cmn",
"zh-hakka": "hak",
"zh-min": null,
"zh-min-nan": "nan",
"zh-wuu": "wuu",
"zh-xiang": "hsn"
}