From 4c03ee943fd6236d3dc139acd2b348a9b1eddd05 Mon Sep 17 00:00:00 2001 From: croneter Date: Sat, 20 Mar 2021 13:58:05 +0100 Subject: [PATCH] Fix indentation --- .tx/import_strings_to_addon_xml.py | 60 +++++++++++++++--------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/.tx/import_strings_to_addon_xml.py b/.tx/import_strings_to_addon_xml.py index d3fdec1d..cc88d657 100644 --- a/.tx/import_strings_to_addon_xml.py +++ b/.tx/import_strings_to_addon_xml.py @@ -60,35 +60,35 @@ def indent(elem, level=0): root = etree.Element('addon') for lang in languages: - try: - with open(os.path.join(PKC_dir, - 'resources', - 'language', - 'resource.language.%s' % lang, - 'strings.po'), 'rb') as f: - for line in f: - if line.strip() in addon: - msg = '' - key = str(line.strip()) - # Advance to the line msgstr "" - part = '' - while not part.startswith('msgstr'): - part = next(f) - msg += part.replace('msgstr', '').replace('"', '').strip() - part = None - while part != '': - part = next(f).strip() - msg += part - msg = msg.replace('"', '').replace('\r', '').replace('\n', '') - print(msg) - etree.SubElement(root, - addon[key], - attrib={'lang': lang}).text = msg.decode('utf-8') - except IOError: - print('Missing file %s' % os.path.join(PKC_dir, - 'resources', - 'language', - 'resource.language.%s' % lang, - 'strings.po')) + try: + with open(os.path.join(PKC_dir, + 'resources', + 'language', + 'resource.language.%s' % lang, + 'strings.po'), 'rb') as f: + for line in f: + if line.strip() in addon: + msg = '' + key = str(line.strip()) + # Advance to the line msgstr "" + part = '' + while not part.startswith('msgstr'): + part = next(f) + msg += part.replace('msgstr', '').replace('"', '').strip() + part = None + while part != '': + part = next(f).strip() + msg += part + msg = msg.replace('"', '').replace('\r', '').replace('\n', '') + print(msg) + etree.SubElement(root, + addon[key], + attrib={'lang': lang}).text = msg.decode('utf-8') + except IOError: + print('Missing file %s' % os.path.join(PKC_dir, + 'resources', + 'language', + 'resource.language.%s' % lang, + 'strings.po')) indent(root) etree.ElementTree(root).write(tmp_file, encoding="UTF-8")