get_supported_language_variant
Returns a supported language-variant code from the provided language code, optionally using strict matching to ensure the variant is explicitly defined in the translation system.
def get_supported_language_variant(
lang_code: string,
strict: boolean = False
) - > string
Returns the language code that is supported by the system, potentially falling back to a more generic variant if the specific one is not available.
Parameters
| Name | Type | Description |
|---|---|---|
| lang_code | string | The language code or locale string to check for support. |
| strict | boolean = False | If True, only an exact match for the language code is accepted; if False, the function allows falling back to a generic variant. |
Returns
| Type | Description |
|---|---|
string | The supported language code variant (e.g., 'en' if 'en-us' is not supported), or raises a LookupError if no match is found. |