diff --git a/.gitignore b/.gitignore index c933d31..a09405a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ Django-*.egg htmlcov/ docs/_build/ .idea/ +*.mo diff --git a/AUTHORS.rst b/AUTHORS.rst index dc27bb6..b25a3cf 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -24,6 +24,7 @@ Michael van Tellingen Mikhail Silonov Patryk Zawadzki Paul McLanahan +Philipp Steinhardt Rinat Shigapov Rodney Folz rsenkbeil diff --git a/CHANGES.rst b/CHANGES.rst index b0f75bd..86eccf5 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -11,6 +11,8 @@ master (unreleased) * Fix Django 1.7 migrations compatibility for SplitField. Thanks ad-m. Merge of GH-157; fixes GH-156. + +* Add German translations. 2.2 (2014.07.31) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index a789156..4992ade 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -22,11 +22,29 @@ 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. .. _AUTHORS: AUTHORS.rst .. _CHANGES: CHANGES.rst +Translations +------------ + +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. +After you finished editing add yourself to the list of translators. +If you have created a new translation, make sure to copy the header from one +of the existing translation files. + Testing ------- diff --git a/MANIFEST.in b/MANIFEST.in index ddc2005..48f0ac9 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,3 +4,4 @@ include LICENSE.txt include MANIFEST.in include README.rst include TODO.rst +locale/*/LC_MESSAGES/django.po \ No newline at end of file diff --git a/model_utils/locale/de/LC_MESSAGES/django.po b/model_utils/locale/de/LC_MESSAGES/django.po new file mode 100644 index 0000000..89c7426 --- /dev/null +++ b/model_utils/locale/de/LC_MESSAGES/django.po @@ -0,0 +1,53 @@ +# This file is distributed under the same license as the django-model-utils package. +# +# Translators: +# Philipp Steinhardt , 2015. +msgid "" +msgstr "" +"Project-Id-Version: django-model-utils\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-07-01 10:03+0200\n" +"PO-Revision-Date: 2015-07-01 10:12+0200\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 +msgid "created" +msgstr "erstellt" + +#: .\models.py:21 +msgid "modified" +msgstr "bearbeitet" + +#: .\models.py:33 +msgid "start" +msgstr "Beginn" + +#: .\models.py:34 +msgid "end" +msgstr "Ende" + +#: .\models.py:49 +msgid "status" +msgstr "Status" + +#: .\models.py:50 +msgid "status changed" +msgstr "Status geändert" + +#: .\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 +msgid "deleted" +msgstr "gelöscht" + +#: .\tests\models.py:108 .\tests\models.py:117 .\tests\models.py:126 +msgid "on hold" +msgstr "wartend" diff --git a/setup.py b/setup.py index 25fca37..40d8e9b 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,8 @@ from os.path import join from setuptools import setup, find_packages +from setuptools.command.install_lib import install_lib as _install_lib +from distutils.command.build import build as _build +from distutils.cmd import Command long_description = (open('README.rst').read() + @@ -14,6 +17,46 @@ def get_version(): return line.split('=')[1].strip().strip('"\'') +class compile_translations(Command): + """command tries to compile messages via django compilemessages, does not + interrupt setup if gettext is not installed""" + + description = 'compile message catalogs to MO files via django compilemessages' + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + import os + import sys + + from django.core.management import execute_from_command_line, CommandError + + curdir = os.getcwd() + os.chdir(os.path.realpath('model_utils')) + + try: + execute_from_command_line(['django-admin', 'compilemessages']) + except CommandError: + # raised if gettext pkg is not installed + pass + finally: + os.chdir(curdir) + + +class build(_build): + sub_commands = [('compile_translations', None)] + _build.sub_commands + + +class install_lib(_install_lib): + def run(self): + self.run_command('compile_translations') + _install_lib.run(self) + setup( name='django-model-utils', version=get_version(), @@ -40,5 +83,11 @@ setup( ], zip_safe=False, tests_require=["Django>=1.4.2"], - test_suite='runtests.runtests' + test_suite='runtests.runtests', + setup_requires=['Django>=1.4.2'], + package_data = { + 'model_utils': ['locale/*/LC_MESSAGES/django.po','locale/*/LC_MESSAGES/django.mo'], + }, + cmdclass={'build': build, 'install_lib': install_lib, + 'compile_translations': compile_translations} )