Philipp Hörist pushed to branch master at gajim / gajim


Commits:
637ef759 by Philipp Hörist at 2024-04-14T17:14:33+02:00
refactor: Builder: Use xpath to find translatable elements

- - - - -


1 changed file:

- gajim/gtk/builder.py


Changes:

=====================================
gajim/gtk/builder.py
=====================================
@@ -53,9 +53,9 @@ def _load_string_from_filename(filename: str, gettext_: Any) 
-> str:
         if sys.platform == 'win32':
             # This is a workaround for non working translation on Windows
             tree = ET.parse(file_path)
-            for node in tree.iter():
-                if 'translatable' in node.attrib and node.text is not None:
-                    node.text = gettext_(node.text)
+            for node in tree.findall(".//*[@translatable='yes']"):
+                node.text = gettext_(node.text) if node.text else ''
+                del node.attrib['translatable']
 
             return ET.tostring(tree.getroot(),
                                encoding='unicode',



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/637ef759490a84f01284d7a00de5a104a9c577cd

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/637ef759490a84f01284d7a00de5a104a9c577cd
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to