mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 15:07:28 -06:00
Fix removing tu
elements
CURA-10376
This commit is contained in:
parent
19b3c93a0c
commit
ef09fe640b
1 changed files with 3 additions and 3 deletions
|
@ -36,7 +36,7 @@ def main(tmx_source_path: Path, tmx_target_path: Path, i18n_path: Path):
|
|||
|
||||
root = load_existing_xmtm(tmx_source_path)
|
||||
root_old = ET.ElementTree(root)
|
||||
ET.indent(root_old, ' ')
|
||||
# ET.indent(root_old, ' ')
|
||||
root_old.write("old.tmx", encoding="utf-8", xml_declaration=True)
|
||||
to_be_removed = []
|
||||
for tu in root.iter("tu"):
|
||||
|
@ -63,10 +63,10 @@ def main(tmx_source_path: Path, tmx_target_path: Path, i18n_path: Path):
|
|||
if tuvs[1].find("seg").text == "\"":
|
||||
to_be_removed.append(tu)
|
||||
|
||||
body = root.find("body")
|
||||
for tu in to_be_removed:
|
||||
root.remove(tu)
|
||||
body.remove(tu)
|
||||
fixed_root = ET.ElementTree(root)
|
||||
ET.indent(fixed_root, ' ')
|
||||
fixed_root.write(tmx_target_path, encoding="utf-8", xml_declaration=True)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue