Finish translate command, fix build

pull/989/head
Piero Toffanin 2021-05-27 09:55:27 -04:00
rodzic d286c72a24
commit 92966f1d29
6 zmienionych plików z 19 dodań i 12 usunięć

Wyświetl plik

@ -84,9 +84,7 @@ def boot():
logger.info("Created settings")
# Invoked via manage.py
if len(sys.argv[1:2]) > 0 and not settings.TESTING:
init_plugins()
init_plugins()
if not settings.TESTING:
try:

Wyświetl plik

@ -17,6 +17,8 @@ def cleanup():
print("Cleanup done!")
class Command(BaseCommand):
requires_system_checks = []
def add_arguments(self, parser):
super(Command, self).add_arguments(parser)

Wyświetl plik

@ -9,9 +9,11 @@ from app.scripts.extract_potree_strings import extract_potree_strings
root = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", ".."))
class Command(BaseCommand):
requires_system_checks = []
def add_arguments(self, parser):
parser.add_argument("action", type=str, choices=['extract', 'build'])
parser.add_argument("--safe", type=bool, required=False, help="Skip invalid languages")
parser.add_argument("--safe", action='store_true', required=False, help="Skip invalid languages")
super(Command, self).add_arguments(parser)
def handle(self, **options):
@ -40,4 +42,13 @@ class Command(BaseCommand):
)
call_command('makemessages', '--keep-pot', *locale_params, '--ignore=build', '--ignore=app/templates/app/registration/*')
call_command('makemessages_djangojs', '--keep-pot', *locale_params, '-d=djangojs', '--extension=jsx', '--extension=js', '--ignore=build', '--ignore=app/static/app/js/vendor', '--ignore=app/static/app/bundles', '--ignore=node_modules', '--language=Python')
call_command('makemessages_djangojs', '--keep-pot', *locale_params, '-d=djangojs', '--extension=jsx', '--extension=js', '--ignore=build', '--ignore=app/static/app/js/vendor', '--ignore=app/static/app/bundles', '--ignore=node_modules', '--language=Python')
elif options.get('action') == 'build':
if options.get('safe'):
for l in locales:
print("Building %s .po files into .mo" % l)
call_command('compilemessages', '--locale=%s' % l)
else:
print("Building .po files into .mo")
call_command('compilemessages')

Wyświetl plik

@ -26,8 +26,6 @@ class GrassEngine:
if self.grass_binary is None:
logger.warning("Could not find a GRASS 7 executable. GRASS scripts will not work.")
else:
logger.info("Initializing GRASS engine using {}".format(self.grass_binary))
def create_context(self, serialized_context = {}):
if self.grass_binary is None: raise GrassEngineException("GRASS engine is unavailable")

Wyświetl plik

@ -68,10 +68,8 @@ def dev_tools(request, action):
logger.info("Moving %s to %s..." % (locale_path, webodm_locale_dir))
copymerge(locale_path, webodm_locale_dir)
logger.info("Running translate.sh extract && translate.sh build safe")
translate_script = os.path.join(settings.BASE_DIR, 'translate.sh')
subprocess.call(['bash', '-c', '%s extract && %s build safe' % (translate_script, translate_script)], cwd=settings.BASE_DIR)
logger.info("Running python manage.py translate extract && python manage.py translate build --safe")
subprocess.call(['bash', '-c', 'python manage.py translate extract && %s python manage.py translate build --safe'], cwd=settings.BASE_DIR)
return JsonResponse({'message': _("Translation files reloaded!"), 'reload': True})
except Exception as e:

Wyświetl plik

@ -154,7 +154,7 @@ DATABASES = {
'NAME': os.environ.get('WO_DATABASE_NAME', 'webodm_dev'),
'USER': os.environ.get('WO_DATABASE_USER', 'postgres'),
'PASSWORD': os.environ.get('WO_DATABASE_PASSWORD', 'postgres'),
'HOST': os.environ.get('WO_DATABASE_HOST', 'db'),
'HOST': os.environ.get('WO_DATABASE_HOST', 'dbxxx'),
'PORT': os.environ.get('WO_DATABASE_PORT', '5432'),
}
}