summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorPoommetee Ketson <poommetee@protonmail.com>2017-07-12 21:33:12 +0700
committerPoommetee Ketson <poommetee@protonmail.com>2017-07-12 21:49:22 +0700
commitfdd2a87b8fe047240176cd0c405453b1c4f3caaf (patch)
tree019628a6b4d494eb0d8b6e6533c7e1668fd97d7d /core
parentf55fff35286eb970f5db0c0cbfd2e96eb3aff8bc (diff)
Ignore fuzzy translations
Diffstat (limited to 'core')
-rw-r--r--core/io/translation_loader_po.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/core/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp
index 6104608961..1a670b0ab0 100644
--- a/core/io/translation_loader_po.cpp
+++ b/core/io/translation_loader_po.cpp
@@ -51,6 +51,8 @@ RES TranslationLoaderPO::load_translation(FileAccess *f, Error *r_error, const S
Ref<Translation> translation = Ref<Translation>(memnew(Translation));
int line = 1;
+ bool skip_this;
+ bool skip_next;
while (true) {
@@ -60,9 +62,10 @@ RES TranslationLoaderPO::load_translation(FileAccess *f, Error *r_error, const S
if (status == STATUS_READING_STRING) {
- if (msg_id != "")
- translation->add_message(msg_id, msg_str);
- else if (config == "")
+ if (msg_id != "") {
+ if (!skip_this)
+ translation->add_message(msg_id, msg_str);
+ } else if (config == "")
config = msg_str;
break;
@@ -85,15 +88,18 @@ RES TranslationLoaderPO::load_translation(FileAccess *f, Error *r_error, const S
ERR_FAIL_V(RES());
}
- if (msg_id != "")
- translation->add_message(msg_id, msg_str);
- else if (config == "")
+ if (msg_id != "") {
+ if (!skip_this)
+ translation->add_message(msg_id, msg_str);
+ } else if (config == "")
config = msg_str;
l = l.substr(5, l.length()).strip_edges();
status = STATUS_READING_ID;
msg_id = "";
msg_str = "";
+ skip_this = skip_next;
+ skip_next = false;
}
if (l.begins_with("msgstr")) {
@@ -110,6 +116,9 @@ RES TranslationLoaderPO::load_translation(FileAccess *f, Error *r_error, const S
}
if (l == "" || l.begins_with("#")) {
+ if (l.find("fuzzy") != -1) {
+ skip_next = true;
+ }
line++;
continue; //nothing to read or comment
}