From fcba00bc6973fcccd2f515d94f8a2fe35a4df13f Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 26 Sep 2019 10:32:44 +1000 Subject: [PATCH] Check for altered translation files that have not been compiled --- .travis.yml | 2 ++ InvenTree/locale/en/LC_MESSAGES/django.po | 4 ++-- ci/check_locale_files.py | 29 +++++++++++++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 ci/check_locale_files.py diff --git a/.travis.yml b/.travis.yml index d8f5641e26..769dd4d37d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,8 @@ script: - cd InvenTree && python3 manage.py makemigrations && cd .. - python3 ci/check_migration_files.py - make coverage + - make translate + - python3 ci/check_locale_files.py - make style after_success: diff --git a/InvenTree/locale/en/LC_MESSAGES/django.po b/InvenTree/locale/en/LC_MESSAGES/django.po index 424244dd51..7374c8ad19 100644 --- a/InvenTree/locale/en/LC_MESSAGES/django.po +++ b/InvenTree/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-09-25 23:59+0000\n" +"POT-Creation-Date: 2019-09-26 00:27+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -20,7 +20,7 @@ msgstr "" #: InvenTree/helpers.py:157 order/models.py:158 order/models.py:203 msgid "Invalid quantity provided" -msgstr "" +msgstr "hello" #: InvenTree/helpers.py:160 msgid "Empty serial number string" diff --git a/ci/check_locale_files.py b/ci/check_locale_files.py new file mode 100644 index 0000000000..caa5d694e3 --- /dev/null +++ b/ci/check_locale_files.py @@ -0,0 +1,29 @@ +""" Check that there are no database migration files which have not been committed. """ + +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +import sys +import subprocess + +print("Checking for uncommitted files...") + +cmd = ['git', 'status'] + +proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + +out, err = proc.communicate() + +locales = [] + +for line in str(out.decode()).split('\n'): + if 'modified:' in line and '/locale/' in line: + locales.append(line) + +if len(locales) > 0: + print("There are {n} unstaged locale files:".format(n=len(locales))) + + for l in locales: + print(" - {l}".format(l=l)) + +sys.exit(len(locales)) \ No newline at end of file