This function supports recognition of:
2-letter codes (ISO 639-1, e.g., "en", "fr")
3-letter codes from both:
Alpha_3_B (bibliographic, e.g., "fre")
Alpha_3_T (terminologic, e.g., "fra")
Full language names (e.g., "English", "French")
For compatibility with open science repositories and modern metadata
standards, this function returns the terminologic code (Alpha_3_T)
when available. If Alpha_3_T is missing for a language, the legacy
bibliographic code (Alpha_3_B) is used as a fallback.
Full language names (e.g., "English", "Spanish") are matched
case-insensitively against the ISO 639-2 Name field. Exact matches are
attempted first; if none are found, a prefix match is used. For example:
This means that:
This behaviour aligns with:
If value is NULL, the language is marked as ":unas" (unspecified).
In some cases<U+2014>especially for historical or moribund languages<U+2014>multiple
similar names may exist. In such cases, it is safer to use a specific
language code (e.g., "ang" instead of "English, Old" and "enm"
for "English, Middle (1100-1500)"). You can also
refer directly to the definitions in ISOcodes::ISO_639_2
for clarity.