| 1 |
|
| 2 |
|
| 3 |
import sys |
| 4 |
import os |
| 5 |
import glob |
| 6 |
import shutil |
| 7 |
import subprocess |
| 8 |
from os.path import basename |
| 9 |
I18n_DIR = "i18n" |
| 10 |
|
| 11 |
if len(sys.argv) < 2: |
| 12 |
print("usage: " + sys.argv[0] + " <source_dir1> <source_dir2> ...") |
| 13 |
sys.exit(1) |
| 14 |
|
| 15 |
if not os.path.exists(I18n_DIR): |
| 16 |
os.mkdir(I18n_DIR) |
| 17 |
|
| 18 |
|
| 19 |
for i in os.listdir(I18n_DIR): |
| 20 |
if i.endswith(".ts"): |
| 21 |
ts_file = os.path.abspath(os.path.join(I18n_DIR, i)) |
| 22 |
try: |
| 23 |
lupdate = subprocess.check_call(['lupdate', '-noobsolete', '-recursive'] + sys.argv[1:] + ['-ts', ts_file]) |
| 24 |
except subprocess.CalledProcessError: |
| 25 |
print("FAILED") |
| 26 |
print("TS: " + ts_file) |
| 27 |
print("Were done") |