From cc6d624f57b8d62c3040c1c900d00bd5c0c732d9 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Thu, 11 Sep 2014 11:19:06 +0200 Subject: [PATCH] Starting with localisation --- doc/development/setup.rst | 12 ++- src/.gitignore | 1 + src/Makefile | 7 ++ src/locale/de/LC_MESSAGES/django.po | 84 +++++++++++++++++++ src/tixl/settings.py | 11 +++ .../templates/tixlcontrol/auth/login.html | 3 +- 6 files changed, 115 insertions(+), 3 deletions(-) create mode 100644 src/Makefile create mode 100644 src/locale/de/LC_MESSAGES/django.po diff --git a/doc/development/setup.rst b/doc/development/setup.rst index 423d9eafb..079defba5 100644 --- a/doc/development/setup.rst +++ b/doc/development/setup.rst @@ -36,9 +36,18 @@ Then, create the local database:: python manage.py syncdb +Create the translation files +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +To generate updated translation files, run a:: + + make localegen + +To compile the language files for use, run:: + + make localecompile + Run the development server ^^^^^^^^^^^^^^^^^^^^^^^^^^ - Execute:: python manage.py runserver @@ -47,7 +56,6 @@ to start a local development webserver on port 8000. Static code checks ^^^^^^^^^^^^^^^^^^ - Before you check in your code into git, always run:: flake8 . diff --git a/src/.gitignore b/src/.gitignore index 6bfabcc70..0d27eb190 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -5,6 +5,7 @@ *.aux *.log *.toc +*.mo *~ .ropeproject __pycache__/ diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 000000000..75067417f --- /dev/null +++ b/src/Makefile @@ -0,0 +1,7 @@ +all: localecompile + +localecompile: + django-admin compilemessages + +localegen: + django-admin makemessages --all diff --git a/src/locale/de/LC_MESSAGES/django.po b/src/locale/de/LC_MESSAGES/django.po new file mode 100644 index 000000000..7f3cf9626 --- /dev/null +++ b/src/locale/de/LC_MESSAGES/django.po @@ -0,0 +1,84 @@ +# tixl translation file German +# Copyright (C) 2014 the tixl authors +# This file is distributed under the same license as the tixl package. +# Raphael Michel , 2014. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: 1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-09-11 11:16+0200\n" +"PO-Revision-Date: 2014-09-11 11:05+200\n" +"Last-Translator: Raphael Michel \n" +"Language-Team: Raphael Michel \n" +"Language: \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" + +#: tixl/settings.py:92 +msgid "German" +msgstr "Deutsch" + +#: tixl/settings.py:93 +msgid "English" +msgstr "Englisch" + +#: tixlbase/admin.py:16 +msgid "The two password fields didn't match." +msgstr "Die beiden eingegebenen Passwörter stimmen nicht überein." + +#: tixlbase/admin.py:18 tixlcontrol/views/auth.py:14 +msgid "Password" +msgstr "Passwort" + +#: tixlbase/admin.py:20 +msgid "Password confirmation" +msgstr "Passwort bestätigen" + +#: tixlbase/admin.py:22 +msgid "Enter the same password as above, for verification." +msgstr "Geben Sie zur Bestätigung das selbe Passwort wie oben ein" + +#: tixlbase/admin.py:50 +msgid "Personal info" +msgstr "Persönliche Daten" + +#: tixlbase/admin.py:51 +msgid "Permissions" +msgstr "Berechtigungen" + +#: tixlbase/models.py:65 +msgid "Letters, digits and @/./+/-/_ only." +msgstr "Nur Buchstaben, Zahlen und @/./+/-/_" + +#: tixlbase/models.py:71 +msgid "E-mail" +msgstr "E-Mail" + +#: tixlbase/models.py:74 +msgid "Given name" +msgstr "Vorname" + +#: tixlbase/models.py:77 +msgid "Family name" +msgstr "Nachname" + +#: tixlcontrol/templates/tixlcontrol/auth/login.html:12 +msgid "Log in" +msgstr "Anmelden" + +#: tixlcontrol/views/auth.py:13 +msgid "E-mail address" +msgstr "E-Mail-Adresse" + +#: tixlcontrol/views/auth.py:18 +msgid "Please enter a correct e-mail address and password." +msgstr "" +"Bitte geben Sie eine gültige Kombination aus E-Mail-Adresse und Passwort ein." + +#: tixlcontrol/views/auth.py:19 +msgid "This account is inactive." +msgstr "Dieses Konto ist deaktiviert." diff --git a/src/tixl/settings.py b/src/tixl/settings.py index 3249e59df..2301caf0d 100644 --- a/src/tixl/settings.py +++ b/src/tixl/settings.py @@ -45,6 +45,7 @@ INSTALLED_APPS = ( MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', @@ -82,6 +83,16 @@ USE_L10N = True USE_TZ = True +LOCALE_PATHS = ( + 'locale', +) + +from django.utils.translation import ugettext_lazy as _ +LANGUAGES = ( + ('de', _('German')), + ('en', _('English')), +) + # Authentication diff --git a/src/tixlcontrol/templates/tixlcontrol/auth/login.html b/src/tixlcontrol/templates/tixlcontrol/auth/login.html index b4897405c..0d5f1ff0f 100644 --- a/src/tixlcontrol/templates/tixlcontrol/auth/login.html +++ b/src/tixlcontrol/templates/tixlcontrol/auth/login.html @@ -1,5 +1,6 @@ {% extends "tixlcontrol/auth/base.html" %} {% load bootstrap3 %} +{% load i18n %} {% block content %}