get_language_info
Retrieves a dictionary of metadata for a given language code from the Django locale configuration, supporting fallback mechanisms and generic language code lookups. It adds a translated version of the language name to the returned information and raises a KeyError if the language code is not found.
def get_language_info(
lang_code: string
) - > dict
Retrieves a dictionary containing metadata for a specific language code, including its name and localized display name. It handles regional variants by falling back to the generic language code and resolves recursive fallback definitions within the locale configuration.
Parameters
| Name | Type | Description |
|---|---|---|
| lang_code | string | The IETF language tag (e.g., 'en' or 'zh-hans') used to look up language metadata in the global locale configuration. |
Returns
| Type | Description |
|---|---|
dict | A dictionary containing language metadata such as 'name', 'name_local', 'bidi', and a 'name_translated' field containing the lazy-translated version of the language name. |