#include "translation_po.h"
#include "core/io/file_access.h"
#ifdef DEBUG_TRANSLATION_PO
void TranslationPO::print_translation_map() {
Error err;
Ref<FileAccess> file = FileAccess::open("translation_map_print_test.txt", FileAccess::WRITE, &err);
if (err != OK) {
ERR_PRINT("Failed to open translation_map_print_test.txt");
return;
}
file->store_line("NPlural : " + String::num_int64(get_plural_forms()));
file->store_line("Plural rule : " + get_plural_rule());
file->store_line("");
List<StringName> context_l;
translation_map.get_key_list(&context_l);
for (const StringName &ctx : context_l) {
file->store_line(" ===== Context: " + String::utf8(String(ctx).utf8()) + " ===== ");
const HashMap<StringName, Vector<StringName>> &inner_map = translation_map[ctx];
List<StringName> id_l;
inner_map.get_key_list(&id_l);
for (List<StringName>::Element *E2 = id_l.front(); E2; E2 = E2->next()) {
StringName id = E2->get();
file->store_line("msgid: " + String::utf8(String(id).utf8()));
for (int i = 0; i < inner_map[id].size(); i++) {
file->store_line("msgstr[" + String::num_int64(i) + "]: " + String::utf8(String(inner_map[id][i]).utf8()));
}
file->store_line("");
}
}
}
#endif
Dictionary TranslationPO::_get_messages() const { … }
void TranslationPO::_set_messages(const Dictionary &p_messages) { … }
Vector<String> TranslationPO::get_translated_message_list() const { … }
Vector<String> TranslationPO::_get_message_list() const { … }
int TranslationPO::_get_plural_index(int p_n) const { … }
int TranslationPO::_eq_test(const Ref<EQNode> &p_node, const Variant &p_result) const { … }
int TranslationPO::_find_unquoted(const String &p_src, char32_t p_chr) const { … }
void TranslationPO::_cache_plural_tests(const String &p_plural_rule, Ref<EQNode> &p_node) { … }
void TranslationPO::set_plural_rule(const String &p_plural_rule) { … }
void TranslationPO::add_message(const StringName &p_src_text, const StringName &p_xlated_text, const StringName &p_context) { … }
void TranslationPO::add_plural_message(const StringName &p_src_text, const Vector<String> &p_plural_xlated_texts, const StringName &p_context) { … }
int TranslationPO::get_plural_forms() const { … }
String TranslationPO::get_plural_rule() const { … }
StringName TranslationPO::get_message(const StringName &p_src_text, const StringName &p_context) const { … }
StringName TranslationPO::get_plural_message(const StringName &p_src_text, const StringName &p_plural_text, int p_n, const StringName &p_context) const { … }
void TranslationPO::erase_message(const StringName &p_src_text, const StringName &p_context) { … }
void TranslationPO::get_message_list(List<StringName> *r_messages) const { … }
int TranslationPO::get_message_count() const { … }
void TranslationPO::_bind_methods() { … }