From 4ec0acfe96e158ac22756df7ac4272ee0dd72529 Mon Sep 17 00:00:00 2001 From: brentinrochester <32650908+brentinrochester@users.noreply.github.com> Date: Wed, 5 Feb 2025 12:09:27 -0500 Subject: [PATCH] Mimic Android Studio XML file structure Use double-quotes around the xml header strings. Indent lines with four spaces. --- android2po/commands.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/android2po/commands.py b/android2po/commands.py index 8f79458..65e9eb8 100644 --- a/android2po/commands.py +++ b/android2po/commands.py @@ -50,8 +50,10 @@ def xml2string(tree, action): """ ENCODING = 'utf-8' dom = convert.write_xml(tree, warnfunc=action.message) - return etree.tostring(dom, xml_declaration=True, - encoding=ENCODING, pretty_print=True).decode('utf-8') + etree.indent(dom, space=" ") + return etree.tostring(dom, xml_declaration=False, + doctype='', + encoding=ENCODING, pretty_print=True).decode(ENCODING) def read_xml(action, filename, **kw): @@ -429,7 +431,7 @@ def execute(self): # This will make us pick up the language on subsequent runs. for kind in self.env.xmlfiles: if write_file(self, language.xml(kind), - """\n\n""", + """\n\n""", update=False, ignore_exists=show_exists): something_done = True