check-frontend-i18n: Add no-generate option.

Adds the option to not generate translation files.
This commit is contained in:
Umair Khan 2017-07-03 11:02:10 +05:00 committed by showell
parent f22b2d27f3
commit 15866b8a1f
1 changed files with 10 additions and 1 deletions

View File

@ -7,6 +7,7 @@ from typing import List, Text
from lib import sanity_check from lib import sanity_check
sanity_check.check_venv(__file__) sanity_check.check_venv(__file__)
import argparse
import json import json
import os import os
import sys import sys
@ -24,7 +25,15 @@ def find_handlebars(translatable_strings):
return errored return errored
if __name__ == '__main__': if __name__ == '__main__':
subprocess.call(['./manage.py', 'makemessages', '--locale', 'en'], stderr=subprocess.STDOUT) parser = argparse.ArgumentParser()
parser.add_argument('--no-generate',
action='store_true', dest='no_generate', default=False,
help="Don't run makemessages command.")
args = parser.parse_args()
if not args.no_generate:
subprocess.call(['./manage.py', 'makemessages', '--locale', 'en'],
stderr=subprocess.STDOUT)
with open('static/locale/en/translations.json') as f: with open('static/locale/en/translations.json') as f:
data = json.load(f) data = json.load(f)