Skip to main content

get_select2_language

Retrieves the supported Select2 language code based on the current environment's language setting, falling back to more general language codes if a specific match is not found.

def get_select2_language() - > string

Retrieves the most appropriate language code supported by Select2 based on the current active language. It performs a fallback search by stripping sub-tags from the language code until a match is found in the supported translations.

Returns

TypeDescription
stringThe matching Select2-compatible language code, or None if no suitable translation is found.