_set_lang_on_g. Internal helper function. This docstring was expanded to make future maintenance easier. Returns: Varies.
()
| 2914 | _EN_WORD_RE = re.compile(r"\b(" + "|".join(sorted(map(re.escape, en_word_keys), key=len, reverse=True)) + r")\b", re.UNICODE) |
| 2915 | else: |
| 2916 | _EN_WORD_RE = None |
| 2917 | |
| 2918 | def _apply_phrase_map(out: str, lang: str) -> str: |
| 2919 | """Apply phrase + word-key replacements safely, then the fallback word-map.""" |
| 2920 | if lang == "el": |
| 2921 | for k in _EL_PHRASE_KEYS: |
| 2922 | out = out.replace(k, TRANSLATIONS_EL[k]) |
| 2923 | if _EL_WORD_RE: |
| 2924 | out = _EL_WORD_RE.sub(lambda m: TRANSLATIONS_EL.get(m.group(1), m.group(1)), out) |
| 2925 | out = _word_translate(out, _WORD_MAP_EL) |
| 2926 | return out |
| 2927 | |
| 2928 | for k in _EN_PHRASE_KEYS: |
| 2929 | out = out.replace(k, TRANSLATIONS_EN[k]) |
nothing calls this directly
no test coverage detected