mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-10 08:17:49 -06:00
Fix warning message appearing for plural forms
There is no msgstr then so it thinks it's empty. Contributes to issue CURA-6663.
This commit is contained in:
parent
79d57ec10a
commit
b1cbaaef72
1 changed files with 14 additions and 2 deletions
|
@ -124,7 +124,8 @@ def find_translation(source: str, msgctxt: str, msgid: str) -> str:
|
||||||
last_source = {
|
last_source = {
|
||||||
"msgctxt": "\"\"\n",
|
"msgctxt": "\"\"\n",
|
||||||
"msgid": "\"\"\n",
|
"msgid": "\"\"\n",
|
||||||
"msgstr": "\"\"\n"
|
"msgstr": "\"\"\n",
|
||||||
|
"msgid_plural": "\"\"\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
current_state = "none"
|
current_state = "none"
|
||||||
|
@ -141,6 +142,10 @@ def find_translation(source: str, msgctxt: str, msgid: str) -> str:
|
||||||
current_state = "msgstr"
|
current_state = "msgstr"
|
||||||
line = line[7:]
|
line = line[7:]
|
||||||
last_source[current_state] = ""
|
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("\""):
|
if line.startswith("\"") and line.endswith("\""):
|
||||||
last_source[current_state] += line + "\n"
|
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")))
|
dest_id = "".join((line.strip()[1:-1] for line in msgid.split("\n")))
|
||||||
|
|
||||||
if source_ctxt == dest_ctxt and source_id == dest_id:
|
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, "!!!")
|
print("!!! Empty translation for {" + dest_ctxt + "}", dest_id, "!!!")
|
||||||
return last_source["msgstr"]
|
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.
|
#Still here? Then the entire msgctxt+msgid combination was not found at all.
|
||||||
print("!!! Missing translation for {" + msgctxt.strip() + "}", msgid.strip(), "!!!")
|
print("!!! Missing translation for {" + msgctxt.strip() + "}", msgid.strip(), "!!!")
|
||||||
return "\"\"\n"
|
return "\"\"\n"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue