Skip to content

Commit

Permalink
Merge 4686fdb into 6c21be2
Browse files Browse the repository at this point in the history
  • Loading branch information
agilewalker committed Aug 23, 2020
2 parents 6c21be2 + 4686fdb commit ec7c4c3
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions contrib/make_locale
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env python3
import os
from os.path import isdir, join
import subprocess
import sys
import io
import zipfile
import requests
import glob
import itertools
from pathlib import Path

assert len(sys.argv) < 3

Expand All @@ -21,14 +23,22 @@ code_directories = [
'lib',
'plugins',
]
cmd = "find {} -type f -name '*.py' -o -name '*.kv'".format(" ".join(code_directories))
file_types = ('*.py', '*.kv')

files = subprocess.check_output(cmd, shell=True)
files = zip(
itertools.count(start=1),
itertools.chain.from_iterable(
glob.iglob(f'{code_directory}/**/{file_type}', recursive=True)
for code_directory in code_directories
for file_type in file_types
)
)

with open("app.fil", "wb") as f:
f.write(files)

print("Found {} files to translate".format(len(files.splitlines())))
with open("app.fil", "w") as f:
for n, file in files:
f.write(f"{Path(file)}\n")
else:
print("Found {} files to translate".format(n))

# Generate fresh translation template
if not os.path.exists('lib/locale'):
Expand Down

0 comments on commit ec7c4c3

Please sign in to comment.