move all translation scripts to tools/

I think we should just move all the scripts to tools/, app/tools is
confusing, not very visible, and non-standard.
This commit is contained in:
Hans-Christoph Steiner 2017-05-10 11:01:50 +02:00
parent b99e95304e
commit 082b6091fc
3 changed files with 8 additions and 4 deletions

View File

@ -12,7 +12,7 @@ before_script:
test:
script:
- ./app/tools/check-string-format.py
- ./tools/check-format-strings.py
- ./gradlew assemble -PdisablePreDex
# always report on lint errors to the build log
- sed -i -e 's,textReport .*,textReport true,' app/build.gradle

View File

@ -1,19 +1,23 @@
#!/usr/bin/env python3
# Remove extra translations
# This script removes strings from the translated files that are not useful:
# * translations for strings that are no longer used
# * empty translated strings, English is better than no text at all
import glob
import os
import re
from xml.etree import ElementTree
resdir = os.path.join(os.path.dirname(__file__), '..', 'app', 'src', 'main', 'res')
strings = set()
for e in ElementTree.parse(os.path.join('src', 'main', 'res', 'values', 'strings.xml')).getroot().findall('.//string'):
for e in ElementTree.parse(os.path.join(resdir, 'values', 'strings.xml')).getroot().findall('.//string'):
name = e.attrib['name']
strings.add(name)
for d in glob.glob(os.path.join('src', 'main', 'res', 'values-*')):
for d in glob.glob(os.path.join(resdir, 'values-*')):
str_path = os.path.join(d, 'strings.xml')
if os.path.exists(str_path):