MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / _set_lang_on_g

Function _set_lang_on_g

Scripts/ButSystem.py:2916–2926  ·  view source on GitHub ↗

_set_lang_on_g. Internal helper function. This docstring was expanded to make future maintenance easier. Returns: Varies.

()

Source from the content-addressed store, hash-verified

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
2918def _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])

Callers

nothing calls this directly

Calls 1

get_langFunction · 0.70

Tested by

no test coverage detected