Implement translation
This commit is contained in:
parent
6aac94436e
commit
d9ccebae54
@ -15,6 +15,7 @@ from account_manager.utils.mail_utils import realm_send_mail
|
||||
from .forms import RealmAddForm, RealmUpdateForm
|
||||
from .models import LdapGroup, LdapUser
|
||||
from ldap import LDAPError
|
||||
from django.utils.translation import gettext
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
from django.templatetags.static import static
|
||||
from django.utils.translation import gettext, ngettext
|
||||
from django.urls import reverse
|
||||
from django.utils import translation
|
||||
|
||||
@ -6,8 +7,10 @@ from jinja2 import Environment
|
||||
|
||||
|
||||
def environment(**options):
|
||||
env = Environment(extensions=['jinja2.ext.i18n'], **options)
|
||||
options['extensions'] = ['jinja2.ext.i18n']
|
||||
env = Environment(**options)
|
||||
# env.install_gettext_translations(translation)
|
||||
env.install_gettext_callables(gettext=gettext, ngettext=ngettext, newstyle=True)
|
||||
env.globals.update({
|
||||
'static': static,
|
||||
'url': reverse,
|
||||
|
||||
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-05-16 13:48+0000\n"
|
||||
"POT-Creation-Date: 2019-05-17 14:23+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -32,10 +32,58 @@ msgstr ""
|
||||
msgid "Deutsch"
|
||||
msgstr ""
|
||||
|
||||
#: templates/base.jinja2:34
|
||||
msgid "LAMa"
|
||||
#. Translators: The Application Name: default LAMa
|
||||
#: templates/base.jinja2:33
|
||||
msgid "AppName"
|
||||
msgstr "LAMa"
|
||||
|
||||
#. Translators: Logout button
|
||||
#: templates/base.jinja2:40
|
||||
msgid "Logout"
|
||||
msgstr ""
|
||||
|
||||
#: templates/user/realm_user_detail.jinja2:23
|
||||
#. Translators: Login Button
|
||||
#: templates/base.jinja2:43
|
||||
msgid "Login"
|
||||
msgstr ""
|
||||
|
||||
#. Translators: About link title
|
||||
#: templates/base.jinja2:58 templates/base_admin.jinja2:50
|
||||
msgid "About"
|
||||
msgstr "Über"
|
||||
|
||||
#: templates/base_admin.jinja2:10
|
||||
msgid "DjangoAdminArea"
|
||||
msgstr "Django Adminbereich"
|
||||
|
||||
#: templates/base_admin.jinja2:14
|
||||
msgid "Realms"
|
||||
msgstr "Bereiche"
|
||||
|
||||
#: templates/base_admin.jinja2:24
|
||||
msgid "RealmOverview"
|
||||
msgstr "Bereichsübersicht"
|
||||
|
||||
#: templates/base_admin.jinja2:27
|
||||
msgid "Realm"
|
||||
msgstr "Bereich"
|
||||
|
||||
#: templates/base_admin.jinja2:31
|
||||
msgid "RealmInformation"
|
||||
msgstr "Bereichsinformationen"
|
||||
|
||||
#: templates/base_admin.jinja2:34
|
||||
msgid "User"
|
||||
msgstr "Nutzer"
|
||||
|
||||
#: templates/base_admin.jinja2:37
|
||||
msgid "Groups"
|
||||
msgstr "Gruppen"
|
||||
|
||||
#: templates/base_admin.jinja2:46
|
||||
msgid "RealmAdd"
|
||||
msgstr "Bereich hinzufügen"
|
||||
|
||||
#: templates/user/realm_user_detail.jinja2:22
|
||||
msgid "Anzeigename:"
|
||||
msgstr ""
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
{#{% load static %}#}
|
||||
{#{% load i18n %}#}
|
||||
{# ===== HTML ===== #}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
@ -31,15 +29,18 @@
|
||||
<a class="navbar-brand" href="{{ url('realm-home') }}">
|
||||
<img src="{{ static('images/lama.svg') }}" width="30" height="30" class="d-inline-block align-top"
|
||||
alt="">
|
||||
{% trans "LAMa" %}
|
||||
{# Translators: The Application Name: default LAMa #}
|
||||
{{ _('AppName') }}
|
||||
</a>
|
||||
|
||||
{% if request.user.is_authenticated %}
|
||||
<span class="navbar-text">
|
||||
Hi <a href="{{ url('realm-home') }}?show_user=True">{{ request.user.username }}</a>!
|
||||
<a href="{{ url('logout') }}?next=/">Logout <i class="fas fa-sign-out-alt"></i></a>
|
||||
{# Translators: Logout button #}
|
||||
<a href="{{ url('logout') }}?next=/">{{ _('Logout') }} <i class="fas fa-sign-out-alt"></i></a>
|
||||
{% else %}
|
||||
<a href="{{ url('login') }}"><i class="fas fa-sign-in-alt"></i> Login</a>
|
||||
{# Translators: Login Button #}
|
||||
<a href="{{ url('login') }}"><i class="fas fa-sign-in-alt"></i> {{ _('Login') }}</a>
|
||||
{% endif %}
|
||||
</span>
|
||||
</nav>
|
||||
@ -48,12 +49,13 @@
|
||||
{% block content %}{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% if not realms and not realm and not request.user.is_superuser%}
|
||||
{% if not realms and not realm and not request.user.is_superuser %}
|
||||
|
||||
<footer class="bg-light footer mt-auto py-3 text-center">
|
||||
<div class="container">
|
||||
<span class="text-muted">
|
||||
<a href="{{ url('about') }}">Über</a>
|
||||
{# Translators: About link title #}
|
||||
<a href="{{ url('about') }}">{{ _('About') }}</a>
|
||||
</span>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{% extends 'base.jinja2' %}
|
||||
{#{% load i18n %}#}
|
||||
|
||||
{% block body %}
|
||||
<div class="d-flex wrapper">
|
||||
@ -8,11 +7,11 @@
|
||||
{% if request.user.is_superuser %}
|
||||
<div class="list-group list-group-flush">
|
||||
<a class="list-group-item list-group-item-action bg-light"
|
||||
href="{{ url('django-additional-admin-list') }}"><i class="fas fa-crown"></i> Django Adminbereich</a>
|
||||
href="{{ url('django-additional-admin-list') }}"><i class="fas fa-crown"></i> {{ _('DjangoAdminArea') }}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if realms %}
|
||||
<h2 class="sidebar-heading">Bereiche</h2>
|
||||
<h2 class="sidebar-heading">{{ _('Realms') }}</h2>
|
||||
<div class="list-group list-group-flush">
|
||||
{% for realm_item in realms %}
|
||||
<a href="{{ url('realm-detail', args=[realm_item.id]) }}"
|
||||
@ -22,20 +21,20 @@
|
||||
{% else %}
|
||||
<div class="list-group-flush">
|
||||
<a href="{{ url('realm-home') }}" class="list-group-item list-group-item-action bg-light">
|
||||
<i class="fas fa-list"></i> Bereichsübersicht</a>
|
||||
<i class="fas fa-list"></i> {{ _('RealmOverview') }}</a>
|
||||
</div>
|
||||
{% if realm %}
|
||||
<h2 class="sidebar-heading">Bereich {{ realm.name }}</h2>
|
||||
<h2 class="sidebar-heading">{{ _('Realm') }} <span class="text-uppercase">{{ realm.name }}</span></h2>
|
||||
<div class="list-group list-group-flush">
|
||||
<a href="{{ url('realm-detail', args=[realm.id]) }}"
|
||||
class="list-group-item list-group-item-action bg-light"><i class="fas fa-cogs"></i>
|
||||
Bereichsinformationen</a>
|
||||
{{ _('RealmInformation') }}</a>
|
||||
<a href="{{ url('realm-user-list', args=[realm.id]) }}"
|
||||
class="list-group-item list-group-item-action bg-light"><i class="fas fa-users"></i>
|
||||
Nutzer</a>
|
||||
{{ _('User') }}</a>
|
||||
<a href="{{ url('realm-group-list', args=[realm.id]) }}"
|
||||
class="list-group-item list-group-item-action bg-light"><i class="fas fa-user-friends"></i>
|
||||
Gruppen</a>
|
||||
{{ _('Groups') }}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
@ -44,11 +43,11 @@
|
||||
<div class="list-group-item bg-light border-0"></div>
|
||||
<a href="{{ url('realm-add') }}"
|
||||
class="list-group-item list-group-item-action bg-light"><i class="fas fa-plus-square"></i>
|
||||
Bereich hinufügen</a>
|
||||
{{ _('RealmAdd') }}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="sidebar-bottom list-group-flush border-top">
|
||||
<a href="{{ url('about') }}" class="list-group-item list-group-item-action bg-light">Über</a>
|
||||
<a href="{{ url('about') }}" class="list-group-item list-group-item-action bg-light">{{ _('About') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{% extends 'base_admin.jinja2' %}
|
||||
{% load i18n %}
|
||||
{% block admin_content %}
|
||||
<div class="row ">
|
||||
<div class="col-12 p-3">
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{% extends 'realm/realm_detailed.jinja2' %}
|
||||
{#{% load i18n %}#}
|
||||
{% import 'macros/form_macros.jinja2' as mform %}
|
||||
|
||||
{% block detail_content %}
|
||||
|
||||
Reference in New Issue
Block a user