filter on relevant cura files

Contribute to CURA-10376
This commit is contained in:
Jelle Spijker 2023-04-04 15:47:56 +02:00
parent af4efad1cf
commit 1763b9bf9d
No known key found for this signature in database
GPG key ID: 034D1C0527888B65

View file

@ -46,7 +46,7 @@ def main(tmx_source_path: Path, tmx_target_path: Path, i18n_path: Path):
to_be_removed = [] to_be_removed = []
for tu in root.iter("tu"): for tu in root.iter("tu"):
# TODO: also add logic for other pot files # 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 continue
tuvs = tu.findall("tuv") tuvs = tu.findall("tuv")
key_source = tuvs[0].find("seg").text key_source = tuvs[0].find("seg").text
@ -68,6 +68,7 @@ def main(tmx_source_path: Path, tmx_target_path: Path, i18n_path: Path):
if tuvs[1].find("seg").text == "\"": if tuvs[1].find("seg").text == "\"":
to_be_removed.append(tu) to_be_removed.append(tu)
print(f"Removed {len(to_be_removed)} elements")
body = root.find("body") body = root.find("body")
for tu in to_be_removed: for tu in to_be_removed:
body.remove(tu) body.remove(tu)