get_supported_language_variant
Return the language code that's listed in supported languages, possibly selecting a more generic variant. Raise LookupError if nothing is found.
def get_supported_language_variant(
lang_code: string,
strict: boolean = False
) - > string
Return the language code that's listed in supported languages, possibly selecting a more generic variant. Raise LookupError if nothing is found.
Parameters
| Name | Type | Description |
|---|---|---|
| lang_code | string | The IETF language tag (e.g., 'en-US' or 'zh-hant-tw') to be validated against supported project languages. |
| strict | boolean = False | If False, the function will attempt to find any country-specific variant if the exact code or its generic base is not supported. |
Returns
| Type | Description |
|---|---|
string | The matching language code from the supported languages list, which may be the original code, a generic variant, or a country-specific fallback. |