subDesTagesMitExtraKaese 2 years ago
parent
commit
9eef108a61

+ 19 - 18
templates/stammbaum/index.html

@@ -1,35 +1,36 @@
 
 {% extends 'homepage/base.html' %}
 {% load static %}
+{% load i18n %}
 
-{% block title %}Stammbaum{% endblock %}
-{% block header %}Stammbaum{% endblock %}
+{% block title %}{% trans "Family Tree" %}{% endblock %}
+{% block header %}{% trans "Family Tree" %}{% endblock %}
 
 {% block status %}
 {% if user.is_authenticated %}
 <p style="text-align:center">
-  Hi {% firstof user.first_name user.username %}!<br/>
+  {% trans "Hello" %} {% firstof user.first_name user.username %}!<br/>
   {% if user.is_staff %}
-  <a href="/admin/stammbaum/" class="link" target="_blank">Stammbaum bearbeiten</a>
+  <a href="/admin/stammbaum/" class="link" target="_blank">{% trans "Edit family tree" %}</a>
   {% endif %}
-  <a href="{% url 'stammbaum-logout' %}" class="link">Logout</a>
+  <a href="{% url 'stammbaum-logout' %}" class="link">{% trans "Logout" %}</a>
 </p>
 {% else %}
 <p style="text-align:center">
-  You are not logged in<br/>
-  <a href="{% url 'stammbaum-login' %}" class="link">Login</a>
-  <a href="{% url 'stammbaum-register' %}" class="link">Register</a>
+  {% trans "You are not logged in" %}<br/>
+  <a href="{% url 'stammbaum-login' %}" class="link">{% trans "Login" %}</a>
+  <a href="{% url 'stammbaum-register' %}" class="link">{% trans "Register" %}</a>
 </p>
 {% endif %}
 {% endblock %}
 
 {% block sidebar %}
 <a href="mailto:stammbaum@justprojects.de" title="stammbaum@justprojects.de" target="_blank"  class='overlay'>
-  <div class='overlay'><b>Kontakt@mail</b></div>
+  <div class='overlay'><b>{% trans "contact@mail" %}</b></div>
 </a>
 {% if perms.stammbaum.view %}
 <div class='overlay'>
-    <div id='img_name'>Bitte Person ausw&auml;hlen, um Bild hinzuzuf&uuml;gen.</div>
+    <div id='img_name'>{% trans "Please select a person to upload their portrait." %}</div>
 </div>
 {% if perms.stammbaum.upload_image %}
 <form method="get" id="form" action="#">
@@ -40,11 +41,11 @@
 {% endif %}
 
 <div class='overlay' id='save'>
-  Speichern als SVG
+  {% trans "Save as SVG" %}
 </div>
 <div id="group">
   <div class='overlay all' style='color:black' onclick='display(null);'>
-    <b>Alles anzeigen</b>
+    <b>{% trans "Show all" %}</b>
   </div>
 </div>
 
@@ -75,16 +76,16 @@
 
   <div class="news">
 
-    <h2 class="news_title">Information</h2>
+    <h2 class="news_title">{% trans "Information" %}</h2>
     <div class="news_body">
       <p>
-        Ihr Account wurde noch nicht freigeschaltet.
+        {% trans "Your account hasn't been validated yet." %}
       </p>
       <p>
-        Sie haben keine Berechtigung diesen Inhalt anzusehen.
+        {% trans "You are not allowed to view this content." %}
       </p>
       <p>
-        Bitte melden Sie sich bei einem Administrator.
+        {% trans "Please contact an administrator." %}
       </p>
     </div>
   </div>
@@ -95,9 +96,9 @@
 
 <div class="news">
 
-  <h2 class="news_title">Zugriff verweigert</h2>
+  <h2 class="news_title">{% trans "Access denied" %}</h2>
   <p>
-    Bitte melden Sie sich an, um diesen Inhalt zu sehen.
+    {% trans "Please login to view this content." %}
   </p>
 </div>
 

+ 6 - 5
templates/stammbaum/login.html

@@ -1,21 +1,22 @@
 {% extends 'homepage/base.html' %}
 {% load static %}
+{% load i18n %}
 
 {% block head %}<link rel="stylesheet" href="{% static 'homepage/form.css' %}">{% endblock %}
 
 {% block title %}Login{% endblock %}
-{% block header %}Stammbaum{% endblock %}
+{% block header %}{% trans "Family Tree" %}{% endblock %}
 
 {% block status %}
 {% if user.is_authenticated %}
 <p style="text-align:center">
-  Hi {% firstof user.first_name user.username %}!<br />
-  <a href="{% url 'stammbaum-logout' %}" class="link">Logout</a>
+  {% trans "Hello" %} {% firstof user.first_name user.username %}!<br />
+  <a href="{% url 'stammbaum-logout' %}" class="link">{% trans "Logout" %}</a>
 </p>
 {% else %}
 <p style="text-align:center">
   You don't have an account?<br />
-  <a href="{% url 'stammbaum-register' %}" class="link">Register</a>
+  <a href="{% url 'stammbaum-register' %}" class="link">{% trans "Register" %}</a>
 </p>
 {% endif %}
 {% endblock %}
@@ -30,6 +31,6 @@
     {% csrf_token %}
     {{ form.as_p }}
     <input type="hidden" name="next" value="/stammbaum/" />
-    <button type="submit" class="submitbtn">Login</button>
+    <button type="submit" class="submitbtn">{% trans "Login" %}</button>
   </form></div>
 {% endblock %}

+ 11 - 10
templates/stammbaum/register.html

@@ -1,21 +1,22 @@
 {% extends 'homepage/base.html' %}
 {% load static %}
+{% load i18n %}
 
 {% block head %}<link rel="stylesheet" href="{% static 'homepage/form.css' %}">{% endblock %}
 
-{% block title %}Registrierung{% endblock %}
-{% block header %}Stammbaum{% endblock %}
+{% block title %}{% trans "Registration" %}{% endblock %}
+{% block header %}{% trans "Family Tree" %}{% endblock %}
 
 {% block status %}
 {% if user.is_authenticated %}
 <p style="text-align:center">
-  Hi {% firstof user.first_name user.username %}!<br />
-  <a href="{% url 'stammbaum-logout' %}" class="link">Logout</a>
+  {% trans "Hello" %} {% firstof user.first_name user.username %}!<br />
+  <a href="{% url 'stammbaum-logout' %}" class="link">{% trans "Logout" %}</a>
 </p>
 {% else %}
 <p style="text-align:center">
-  You are not logged in<br />
-  <a href="{% url 'stammbaum-login' %}" class="link">Login</a>
+  {% trans "You are not logged in" %}<br />
+  <a href="{% url 'stammbaum-login' %}" class="link">{% trans "Login" %}</a>
 </p>
 {% endif %}
 {% endblock %}
@@ -24,19 +25,19 @@
 
 <div class="news">
 
-  <h2 class="news_title">Registrierung</h2>
+  <h2 class="news_title">{% trans "Registration" %}</h2>
   <p>
-    Um Zugriff auf den Stammbaum zu erhalten, m&uuml;ssen Sie sich registrieren. Ihr Account wird anschließend von einem Admin freigeschaltet.
+    {% trans "You need to register to get access to this page. Your account will then proceed to be validated by an admin." %}
   </p>
   <hr/>
   <form method="post" class="form_container">
     {% csrf_token %}
     {{ form.as_p }}
     
-    <button type="submit" class="submitbtn">Registrieren</button>
+    <button type="submit" class="submitbtn">{% trans "Register" %}</button>
   </form>
 
   <hr/>
-  <p>Already have an account? <a href="{% url 'stammbaum-login' %}">Sign in</a>.</p>
+  <p>{% trans "Already have an account?" %} <a href="{% url 'stammbaum-login' %}">{% trans "Sign in" %}</a>.</p>
 </div>
 {% endblock %}

+ 16 - 13
templates/stammbaum/upload.html

@@ -1,31 +1,34 @@
 {% extends 'homepage/base.html' %}
 {% load static %}
+{% load i18n %}
 
-{% block title %}Stammbaum{% endblock %}
-{% block header %}Bild f&uuml;r {{ person.name }} hochladen{% endblock %}
+{% block title %}{% trans "Family Tree" %}{% endblock %}
+{% block header %}{{ image_upload_text }}{% endblock %}
 
 {% block status %}
 {% if user.is_authenticated %}
 <p style="text-align:center">
-  Hi {{ user.username }}!<br/>
-  <a href="{% url 'stammbaum-logout' %}" class="link">Logout</a>
+  {% trans "Hello" %} {{ user.username }}!<br/>
+  <a href="{% url 'stammbaum-logout' %}" class="link">{% trans "Logout" %}</a>
 </p>
 {% else %}
 <p style="text-align:center">
-  You are not logged in<br/>
-  <a href="{% url 'stammbaum-login' %}" class="link">Login</a>
+  {% trans "You are not logged in" %}<br/>
+  <a href="{% url 'stammbaum-login' %}" class="link">{% trans "Login" %}</a>
 </p>
 {% endif %}
 <br/>
-<a href="/stammbaum/">Zur&uuml;ck</a>
+<a href="/stammbaum/" class="link">{% trans "Back" %}</a>
 {% endblock %}
 
 {% block content %}
-<div style="margin: auto">
-  <form method="post" enctype="multipart/form-data">
-    {% csrf_token %}
-    {{ form.as_p }}
-    <button type="submit">Upload</button>
-  </form>
+<div class="news" style="margin: auto">
+  <p>
+    <form method="post" enctype="multipart/form-data">
+      {% csrf_token %}
+      {{ form.as_p }}
+      <button type="submit">{% trans "Upload" %}</button>
+    </form>
+  </p>
 </div>
 {% endblock %}

+ 5 - 0
views.py

@@ -8,6 +8,7 @@ from django.http import HttpResponse, FileResponse
 from django.urls import reverse_lazy
 from django.views.generic import UpdateView
 from django.views.decorators.cache import cache_control
+from django.utils.translation import gettext
 
 from django.contrib import auth
 from django.contrib.auth.decorators import permission_required
@@ -104,3 +105,7 @@ class UploadImageView(PermissionRequiredMixin, UpdateView):
   permission_required = ("stammbaum.view", "stammbaum.upload_image")
   template_name = "stammbaum/upload.html"
   success_url = "/stammbaum/"
+
+  def get_context_data(self, **kwargs):
+    kwargs['image_upload_text'] = gettext("Upload image for {}").format(self.object.name)
+    return super().get_context_data(**kwargs)