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:
parent
b99e95304e
commit
082b6091fc
@ -12,7 +12,7 @@ before_script:
|
|||||||
|
|
||||||
test:
|
test:
|
||||||
script:
|
script:
|
||||||
- ./app/tools/check-string-format.py
|
- ./tools/check-format-strings.py
|
||||||
- ./gradlew assemble -PdisablePreDex
|
- ./gradlew assemble -PdisablePreDex
|
||||||
# always report on lint errors to the build log
|
# always report on lint errors to the build log
|
||||||
- sed -i -e 's,textReport .*,textReport true,' app/build.gradle
|
- sed -i -e 's,textReport .*,textReport true,' app/build.gradle
|
||||||
|
@ -1,19 +1,23 @@
|
|||||||
#!/usr/bin/env python3
|
#!/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 glob
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from xml.etree import ElementTree
|
from xml.etree import ElementTree
|
||||||
|
|
||||||
|
resdir = os.path.join(os.path.dirname(__file__), '..', 'app', 'src', 'main', 'res')
|
||||||
|
|
||||||
strings = set()
|
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']
|
name = e.attrib['name']
|
||||||
strings.add(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')
|
str_path = os.path.join(d, 'strings.xml')
|
||||||
if os.path.exists(str_path):
|
if os.path.exists(str_path):
|
Loading…
x
Reference in New Issue
Block a user