Skip to content

Commit

Permalink
filter on relevant cura files
Browse files Browse the repository at this point in the history
Contribute to CURA-10376
  • Loading branch information
jellespijker committed Apr 4, 2023
1 parent af4efad commit 1763b9b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/fix_translation_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def main(tmx_source_path: Path, tmx_target_path: Path, i18n_path: Path):
to_be_removed = []
for tu in root.iter("tu"):
# TODO: also add logic for other pot files
if "cura.pot" not in [t.text for t in tu.findall("prop") if t.attrib["type"] == "x-smartling-file"]:
if [t.text for t in tu.findall("prop") if t.attrib["type"] == "x-smartling-file"][0] not in ("cura.pot", "fdmprinter.def.json.pot", "fdmextruder.def.json.pot"):
continue
tuvs = tu.findall("tuv")
key_source = tuvs[0].find("seg").text
Expand All @@ -68,6 +68,7 @@ def main(tmx_source_path: Path, tmx_target_path: Path, i18n_path: Path):
if tuvs[1].find("seg").text == "\"":
to_be_removed.append(tu)

print(f"Removed {len(to_be_removed)} elements")
body = root.find("body")
for tu in to_be_removed:
body.remove(tu)
Expand Down

0 comments on commit 1763b9b

Please sign in to comment.