mirror of
https://github.com/Hopiu/django-model-utils.git
synced 2026-03-16 20:00:23 +00:00
Add script and makefile tasks for making and compiling messages; un-gitignore .mo files.
This commit is contained in:
parent
b2149c8e73
commit
114f4fe228
6 changed files with 69 additions and 17 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -8,5 +8,4 @@ Django-*.egg
|
|||
htmlcov/
|
||||
docs/_build/
|
||||
.idea/
|
||||
*.mo
|
||||
.eggs/
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
6
Makefile
6
Makefile
|
|
@ -13,3 +13,9 @@ docs: documentation
|
|||
|
||||
documentation:
|
||||
python setup.py build_sphinx
|
||||
|
||||
messages:
|
||||
python translations.py make
|
||||
|
||||
compilemessages:
|
||||
python translations.py compile
|
||||
|
|
|
|||
BIN
model_utils/locale/de/LC_MESSAGES/django.mo
Normal file
BIN
model_utils/locale/de/LC_MESSAGES/django.mo
Normal file
Binary file not shown.
|
|
@ -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 <steinhardt@myvision.de>\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 <steinhardt@myvision.de>\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"
|
||||
|
|
|
|||
45
translations.py
Executable file
45
translations.py
Executable file
|
|
@ -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])
|
||||
Loading…
Reference in a new issue