Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGhostkeeper <rubend@tutanota.com>2019-07-26 16:53:42 +0300
committerGhostkeeper <rubend@tutanota.com>2019-07-26 16:53:42 +0300
commitb1cbaaef72e6f68f539872a849d76626a8a3193b (patch)
treed82b6c50f5c2851a6380ddc50ea7e676b945cbea /scripts
parent79d57ec10ad79402267ab06a04d9cf03a25b597b (diff)
Fix warning message appearing for plural forms
There is no msgstr then so it thinks it's empty. Contributes to issue CURA-6663.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lionbridge_import.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/scripts/lionbridge_import.py b/scripts/lionbridge_import.py
index 7b4d510639..07c5d5b66a 100644
--- a/scripts/lionbridge_import.py
+++ b/scripts/lionbridge_import.py
@@ -124,7 +124,8 @@ def find_translation(source: str, msgctxt: str, msgid: str) -> str:
last_source = {
"msgctxt": "\"\"\n",
"msgid": "\"\"\n",
- "msgstr": "\"\"\n"
+ "msgstr": "\"\"\n",
+ "msgid_plural": "\"\"\n"
}
current_state = "none"
@@ -141,6 +142,10 @@ def find_translation(source: str, msgctxt: str, msgid: str) -> str:
current_state = "msgstr"
line = line[7:]
last_source[current_state] = ""
+ elif line.startswith("msgid_plural \""):
+ current_state = "msgid_plural"
+ line = line[13:]
+ last_source[current_state] = ""
if line.startswith("\"") and line.endswith("\""):
last_source[current_state] += line + "\n"
@@ -152,10 +157,17 @@ def find_translation(source: str, msgctxt: str, msgid: str) -> str:
dest_id = "".join((line.strip()[1:-1] for line in msgid.split("\n")))
if source_ctxt == dest_ctxt and source_id == dest_id:
- if last_source["msgstr"] == "\"\"\n":
+ if last_source["msgstr"] == "\"\"\n" and last_source["msgid_plural"] == "\"\"\n":
print("!!! Empty translation for {" + dest_ctxt + "}", dest_id, "!!!")
return last_source["msgstr"]
+ last_source = {
+ "msgctxt": "\"\"\n",
+ "msgid": "\"\"\n",
+ "msgstr": "\"\"\n",
+ "msgid_plural": "\"\"\n"
+ }
+
#Still here? Then the entire msgctxt+msgid combination was not found at all.
print("!!! Missing translation for {" + msgctxt.strip() + "}", msgid.strip(), "!!!")
return "\"\"\n"