#!/bin/bash LOCALES=$(cat LOCALES) if [[ "$1" == "extract" ]]; then echo "Extracting .po files from Django/React" locale_param="" for lang in $LOCALES do locale_param="--locale=$lang $locale_param" done mkdir -p locale python3 app/scripts/extract_potree_strings.py app/static/app/js/vendor/potree/build/potree/resources/lang/en/translation.json app/static/app/js/translations/potree_autogenerated.js python3 app/scripts/extract_odm_strings.py https://raw.githubusercontent.com/OpenDroneMap/ODM/master/opendm/config.py app/static/app/js/translations/odm_autogenerated.js python3 app/scripts/extract_plugin_manifest_strings.py plugins/ app/translations/plugin_manifest_autogenerated.py django-admin makemessages --keep-pot $locale_param --ignore=build --ignore=app/templates/app/registration/* python manage.py makemessages_djangojs --keep-pot $locale_param -d djangojs --extension jsx --extension js --ignore=build --ignore app/static/app/js/vendor --ignore app/static/app/bundles --ignore node_modules --language Python fi if [[ "$1" == "build" ]]; then if [[ "$2" == "safe" ]]; then for lang in $LOCALES do echo "Building $lang .po files into .mo" django-admin compilemessages --locale=$lang done else echo "Building .po files into .mo" django-admin compilemessages fi fi