Starting with localisation

This commit is contained in:
Raphael Michel
2014-09-11 11:19:06 +02:00
parent 5243bba883
commit cc6d624f57
6 changed files with 115 additions and 3 deletions

View File

@@ -36,9 +36,18 @@ Then, create the local database::
python manage.py syncdb 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 Run the development server
^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^
Execute:: Execute::
python manage.py runserver python manage.py runserver
@@ -47,7 +56,6 @@ to start a local development webserver on port 8000.
Static code checks Static code checks
^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
Before you check in your code into git, always run:: Before you check in your code into git, always run::
flake8 . flake8 .

1
src/.gitignore vendored
View File

@@ -5,6 +5,7 @@
*.aux *.aux
*.log *.log
*.toc *.toc
*.mo
*~ *~
.ropeproject .ropeproject
__pycache__/ __pycache__/

7
src/Makefile Normal file
View File

@@ -0,0 +1,7 @@
all: localecompile
localecompile:
django-admin compilemessages
localegen:
django-admin makemessages --all

View File

@@ -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 <michel@rami.io>, 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 <michel@rami.io>\n"
"Language-Team: Raphael Michel <michel@rami.io>\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."

View File

@@ -45,6 +45,7 @@ INSTALLED_APPS = (
MIDDLEWARE_CLASSES = ( MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware', 'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
@@ -82,6 +83,16 @@ USE_L10N = True
USE_TZ = True USE_TZ = True
LOCALE_PATHS = (
'locale',
)
from django.utils.translation import ugettext_lazy as _
LANGUAGES = (
('de', _('German')),
('en', _('English')),
)
# Authentication # Authentication

View File

@@ -1,5 +1,6 @@
{% extends "tixlcontrol/auth/base.html" %} {% extends "tixlcontrol/auth/base.html" %}
{% load bootstrap3 %} {% load bootstrap3 %}
{% load i18n %}
{% block content %} {% block content %}
<form class="form-signin" action="" method="post"> <form class="form-signin" action="" method="post">
{% bootstrap_form_errors form type='all' layout='inline' %} {% bootstrap_form_errors form type='all' layout='inline' %}
@@ -8,7 +9,7 @@
{% bootstrap_field form.password %} {% bootstrap_field form.password %}
<div class="form-group buttons"> <div class="form-group buttons">
<button type="submit" class="btn btn-primary"> <button type="submit" class="btn btn-primary">
Log in {% trans "Log in" %}
</button> </button>
</div> </div>
</form> </form>