MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / add_message

Method add_message

core/string/translation_po.cpp:232–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230}
231
232void TranslationPO::add_message(const StringName &p_src_text, const StringName &p_xlated_text, const StringName &p_context) {
233 HashMap<StringName, Vector<StringName>> &map_id_str = translation_map[p_context];
234
235 if (map_id_str.has(p_src_text)) {
236 WARN_PRINT(vformat("Double translations for \"%s\" under the same context \"%s\" for locale \"%s\".\nThere should only be one unique translation for a given string under the same context.", String(p_src_text), String(p_context), get_locale()));
237 map_id_str[p_src_text].set(0, p_xlated_text);
238 } else {
239 map_id_str[p_src_text].push_back(p_xlated_text);
240 }
241}
242
243void TranslationPO::add_plural_message(const StringName &p_src_text, const Vector<String> &p_plural_xlated_texts, const StringName &p_context) {
244 ERR_FAIL_COND_MSG(p_plural_xlated_texts.size() != plural_forms, vformat("Trying to add plural texts that don't match the required number of plural forms for locale \"%s\".", get_locale()));

Callers

nothing calls this directly

Calls 5

vformatFunction · 0.85
StringClass · 0.70
hasMethod · 0.45
setMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected