MCPcopy Create free account
hub / github.com/TaskingAI/TaskingAI / i18n_text

Function i18n_text

backend/app/services/tool/plugin/cache.py:161–180  ·  view source on GitHub ↗

Translate the original text to the target language using i18n. :param bundle_id: The bundle ID. :param original: The original text. :param lang: The target language. :return: text in the target language.

(
    bundle_id: str,
    original: str,
    lang: str,
)

Source from the content-addressed store, hash-verified

159
160
161def i18n_text(
162 bundle_id: str,
163 original: str,
164 lang: str,
165):
166 """
167 Translate the original text to the target language using i18n.
168
169 :param bundle_id: The bundle ID.
170 :param original: The original text.
171 :param lang: The target language.
172 :return: text in the target language.
173 """
174 global _i18n_dict
175 if original.startswith("i18n:"):
176 key = original[5:]
177 i18n_key = f"{bundle_id}:{lang}:{key}"
178 return _i18n_dict.get(i18n_key, "") or _i18n_dict.get(f"{bundle_id}:{CONFIG.DEFAULT_LANG}:{key}", "")
179
180 return original

Callers 5

ui_fetch_toolsFunction · 0.90
to_dictMethod · 0.90
to_response_dictMethod · 0.90
transform_input_schemaFunction · 0.90
to_dictMethod · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected