| 230 | } |
| 231 | |
| 232 | void 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 | |
| 243 | void 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())); |