()
| 502 | |
| 503 | |
| 504 | def get_select2_language(): |
| 505 | lang_code = get_language() |
| 506 | supported_code = SELECT2_TRANSLATIONS.get(lang_code) |
| 507 | if supported_code is None and lang_code is not None: |
| 508 | # If 'zh-hant-tw' is not supported, try subsequent language codes i.e. |
| 509 | # 'zh-hant' and 'zh'. |
| 510 | i = None |
| 511 | while (i := lang_code.rfind("-", 0, i)) > -1: |
| 512 | if supported_code := SELECT2_TRANSLATIONS.get(lang_code[:i]): |
| 513 | return supported_code |
| 514 | return supported_code |
| 515 | |
| 516 | |
| 517 | class AutocompleteMixin: |
no test coverage detected