mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 07:38:58 +08:00
Fix comparisons when source is single-line but dest is multi-line
Or vice-versa. It's now agnostic to number of lines. Contributes to issue CURA-6663.
This commit is contained in:
parent
9e059b7a1a
commit
79d57ec10a
@ -146,10 +146,11 @@ def find_translation(source: str, msgctxt: str, msgid: str) -> str:
|
|||||||
last_source[current_state] += line + "\n"
|
last_source[current_state] += line + "\n"
|
||||||
else: #White lines trigger us to process this translation. Is it the correct one?
|
else: #White lines trigger us to process this translation. Is it the correct one?
|
||||||
#Process the source and destination keys for comparison independent of newline technique.
|
#Process the source and destination keys for comparison independent of newline technique.
|
||||||
source_ctxt = "".join((line.strip()[1:-1].strip() for line in last_source["msgctxt"].split("\n")))
|
source_ctxt = "".join((line.strip()[1:-1] for line in last_source["msgctxt"].split("\n")))
|
||||||
source_id = "".join((line.strip()[1:-1].strip() for line in last_source["msgid"].split("\n")))
|
source_id = "".join((line.strip()[1:-1] for line in last_source["msgid"].split("\n")))
|
||||||
dest_ctxt = "".join((line.strip()[1:-1].strip() for line in msgctxt.split("\n")))
|
dest_ctxt = "".join((line.strip()[1:-1] for line in msgctxt.split("\n")))
|
||||||
dest_id = "".join((line.strip()[1:-1].strip() 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":
|
||||||
print("!!! Empty translation for {" + dest_ctxt + "}", dest_id, "!!!")
|
print("!!! Empty translation for {" + dest_ctxt + "}", dest_id, "!!!")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user