From 114f4fe2281537a5b48234e052733a8fa1692dcf Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Mon, 20 Jul 2015 10:20:11 -0600 Subject: [PATCH] Add script and makefile tasks for making and compiling messages; un-gitignore .mo files. --- .gitignore | 1 - CONTRIBUTING.rst | 10 +++-- Makefile | 6 +++ model_utils/locale/de/LC_MESSAGES/django.mo | Bin 0 -> 760 bytes model_utils/locale/de/LC_MESSAGES/django.po | 24 +++++------ translations.py | 45 ++++++++++++++++++++ 6 files changed, 69 insertions(+), 17 deletions(-) create mode 100644 model_utils/locale/de/LC_MESSAGES/django.mo create mode 100755 translations.py diff --git a/.gitignore b/.gitignore index ebd0ff6..5f1c259 100644 --- a/.gitignore +++ b/.gitignore @@ -8,5 +8,4 @@ Django-*.egg htmlcov/ docs/_build/ .idea/ -*.mo .eggs/ diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 4992ade..6b2b848 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -22,9 +22,11 @@ When creating a pull request, try to: - Note important changes in the `CHANGES`_ file - Update the documentation if needed - Add yourself to the `AUTHORS`_ file -- If you have added or changed translation strings, update translations - of languages you are able to do so. Also mention that translations need - to be updated in your pull request and commit message. +- If you have added or changed translated strings, run ``make messages`` to + update the ``.po`` translation files, and update translations for any + languages you know. Then run ``make compilemessages`` to compile the ``.mo`` + files. If your pull request leaves some translations incomplete, please + mention that in the pull request and commit message. .. _AUTHORS: AUTHORS.rst .. _CHANGES: CHANGES.rst @@ -37,7 +39,7 @@ If you are able to provide translations for a new language or to update an existing translation file, make sure to run makemessages beforehand:: python django-admin.py makemessages -l ISO_LANGUAGE_CODE - + This command will collect all translation strings from the source directory and create or update the translation file for the given language. Now open the translation file (.po) with a text-editor and start editing. diff --git a/Makefile b/Makefile index c736206..4785478 100644 --- a/Makefile +++ b/Makefile @@ -13,3 +13,9 @@ docs: documentation documentation: python setup.py build_sphinx + +messages: + python translations.py make + +compilemessages: + python translations.py compile diff --git a/model_utils/locale/de/LC_MESSAGES/django.mo b/model_utils/locale/de/LC_MESSAGES/django.mo new file mode 100644 index 0000000000000000000000000000000000000000..7b80928ef794836df63af2149725a5f84bdaa149 GIT binary patch literal 760 zcmZ9J&ubJh6vv}ht%HgP-V`EU{6Xr>g0{}OBCT5}xVW^d_w3|#HZ_|JNw(TQ#Q(s9 zCy#pZA_eary@)rjdh_TvJ8KIDzVpc=-}mMv@B8JYHw-I-u0jU70DXee`URbVenV%W zKMS%GjGe-M8C(X>gX#PVcpAJ0ro0>AMesIgp$AYpe|NIYdk>yN{1IFNKZB{4FJP+o z6-;%$E%*bxg!m_jQb#M*O!+A%`BP0;<~^o*smJ+}Rn+^$Do-+!Vu}nUl2vT#l-|_{ zoaGZ|6bn)Mn7(lq7U0!H+8UmrcY9Ptv8BWd@`QI!k{5kj;fZZs z^0l#!+0e|qG-A{FX(+jE=3(e{y1d=?Zd!i5$BSFtjLDZ68^c3KGA6Q`%;ASnO(N@C iMQlvck4Z<0>=j0qhPh6)wwCR*!)w87I(!R1hWZyZioON_ literal 0 HcmV?d00001 diff --git a/model_utils/locale/de/LC_MESSAGES/django.po b/model_utils/locale/de/LC_MESSAGES/django.po index 89c7426..342b3cf 100644 --- a/model_utils/locale/de/LC_MESSAGES/django.po +++ b/model_utils/locale/de/LC_MESSAGES/django.po @@ -6,48 +6,48 @@ msgid "" msgstr "" "Project-Id-Version: django-model-utils\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-07-01 10:03+0200\n" +"POT-Creation-Date: 2015-07-20 10:17-0600\n" "PO-Revision-Date: 2015-07-01 10:12+0200\n" +"Last-Translator: Philipp Steinhardt \n" +"Language-Team: \n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"Last-Translator: Philipp Steinhardt \n" -"Language-Team: \n" -#: .\models.py:20 +#: models.py:20 msgid "created" msgstr "erstellt" -#: .\models.py:21 +#: models.py:21 msgid "modified" msgstr "bearbeitet" -#: .\models.py:33 +#: models.py:33 msgid "start" msgstr "Beginn" -#: .\models.py:34 +#: models.py:34 msgid "end" msgstr "Ende" -#: .\models.py:49 +#: models.py:49 msgid "status" msgstr "Status" -#: .\models.py:50 +#: models.py:50 msgid "status changed" msgstr "Status geändert" -#: .\tests\models.py:106 .\tests\models.py:115 .\tests\models.py:124 +#: tests/models.py:106 tests/models.py:115 tests/models.py:124 msgid "active" msgstr "aktiv" -#: .\tests\models.py:107 .\tests\models.py:116 .\tests\models.py:125 +#: tests/models.py:107 tests/models.py:116 tests/models.py:125 msgid "deleted" msgstr "gelöscht" -#: .\tests\models.py:108 .\tests\models.py:117 .\tests\models.py:126 +#: tests/models.py:108 tests/models.py:117 tests/models.py:126 msgid "on hold" msgstr "wartend" diff --git a/translations.py b/translations.py new file mode 100755 index 0000000..58b107f --- /dev/null +++ b/translations.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +import os +import sys + +from django.conf import settings +import django + + +DEFAULT_SETTINGS = dict( + INSTALLED_APPS=( + 'model_utils', + 'model_utils.tests', + ), + DATABASES={ + "default": { + "ENGINE": "django.db.backends.sqlite3" + } + }, + SILENCED_SYSTEM_CHECKS=["1_7.W001"], + ) + + +def run(command): + if not settings.configured: + settings.configure(**DEFAULT_SETTINGS) + + # Compatibility with Django 1.7's stricter initialization + if hasattr(django, 'setup'): + django.setup() + + parent = os.path.dirname(os.path.abspath(__file__)) + appdir = os.path.join(parent, 'model_utils') + os.chdir(appdir) + + from django.core.management import call_command + + call_command('%smessages' % command) + + +if __name__ == '__main__': + if (len(sys.argv)) < 2 or (sys.argv[1] not in {'make', 'compile'}): + print("Run `translations.py make` or `translations.py compile`.") + sys.exit(1) + run(sys.argv[1])