diff --git a/tools/remove-unused-and-blank-translations.py b/tools/remove-unused-and-blank-translations.py index 294903256..867b1c8b0 100755 --- a/tools/remove-unused-and-blank-translations.py +++ b/tools/remove-unused-and-blank-translations.py @@ -44,8 +44,6 @@ for d in sorted(glob.glob(os.path.join(resdir, 'values-*'))): # should not be in the translation files anyway with open(str_path, 'rb') as fp: contents = fp.read() - contents = contents.replace(b' tools:ignore="UnusedResources"', b'') \ - .replace(b' xmlns:tools="http://schemas.android.com/tools"', b'') root = ElementTree.fromstring(contents) for e in root.findall('.//string'): @@ -67,9 +65,11 @@ for d in sorted(glob.glob(os.path.join(resdir, 'values-*'))): count += 1 result = re.sub(r' />', r'/>', ElementTree.tostring(root, encoding='utf-8').decode('utf-8')) + result = re.sub(r'xmlns:ns0=', r'xmlns:tools=', result) + result = re.sub(r' ns0:ignore=', r' tools:ignore=', result) result = re.sub(r'resources>\n ', r'', result) + result = re.sub(r'[ \t]*', r'\n', result) with open(str_path, 'w+') as f: f.write(re.sub(r"'", r'"', header))