Don't run translations in travis if the commit containing the changed message files also contains changed translation files
# 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' | wc -l)
+translation_files_changed=$(git diff --name-only HEAD~1..HEAD -- '*.po' | wc -l)
-# If any relevant files changed, update translations.
-if [ "${message_files_changed}" -gt 0 ]
+# 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"
