Add comments and some more status output.
# that were changed in the last commit.
# https://docs.djangoproject.com/en/1.11/ref/django-admin/
message_files_changed=$(git diff --name-only HEAD~1..HEAD -- '*.html' '*.txt' '*.py' --porcelain | wc -l)
+# Count the number of translation files changed.
translation_files_changed=$(git diff --name-only HEAD~1..HEAD -- '*.po' --porcelain | wc -l)
# If any relevant files changed but no translation files changed,
# update translations.
if [ "${message_files_changed}" -gt 0 ] && [ "${translation_files_changed}" -eq 0 ]
then
- # Compile translations
+
echo "makemessages"
langs=($(python manage.py diffsettings | grep '^LANGUAGES =' | grep -o "(u'[^']*'" | grep -o "'[^']*'" | xargs))
for locale in "${langs[@]}"; do
@@ -20,4 +21,6 @@ then
echo "compilemessages"
python manage.py compilemessages || exit 1
+else
+ echo "No translatable source files changed."
fi
