From 1cb419f73f2192da90fc1e25c517583aec46e52b Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Wed, 26 Jan 2022 15:54:27 +0100 Subject: [PATCH] in modells we use lazy translation --- evapp/models.py | 3 ++- evapp/tests.py | 1 + locale/en/LC_MESSAGES/django.po | 6 +++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/evapp/models.py b/evapp/models.py index ac36557..ccf6548 100644 --- a/evapp/models.py +++ b/evapp/models.py @@ -1,5 +1,6 @@ from django.db import models from multiselectfield import MultiSelectField +from django.utils.translation import gettext_lazy as _ # ATTENTION!!! # No key should be used twice in any of these dicts because of the @@ -46,7 +47,7 @@ class Employee(models.Model): # usermail = models.EmailField(max_length=50, verbose_name="Deine Mailadresse (Ansprechpartner_in)", default='bestechefin@wikimedia.de') # personal data - firstname = models.CharField(max_length=50, verbose_name="Vorname") + firstname = models.CharField(max_length=50, verbose_name=_("Vorname")) lastname = models.CharField(max_length=50, verbose_name="Nachname") # intern = models.BooleanField(verbose_name='Interne_r Mitarbeiter_in?', default=True) department = models.CharField(max_length=5, choices=DEPARTMENT_CHOICES.items(), verbose_name='Bereich') diff --git a/evapp/tests.py b/evapp/tests.py index 92e7f99..3e7109f 100644 --- a/evapp/tests.py +++ b/evapp/tests.py @@ -25,6 +25,7 @@ class LoginTestCase(TestCase): print (response_en.content) print('END') self.assertContains(response_en, 'You are logged in as vladimir@reiherzehe.com', status_code=200) + self.assertContains(response_en, 'Firstname', status_code=200) def testDebugWarning(self): with self.settings(DEBUG=True): diff --git a/locale/en/LC_MESSAGES/django.po b/locale/en/LC_MESSAGES/django.po index 3b96869..4527503 100644 --- a/locale/en/LC_MESSAGES/django.po +++ b/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-01-26 13:11+0100\n" +"POT-Creation-Date: 2022-01-26 15:52+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -18,6 +18,10 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" +#: evapp/models.py:50 +msgid "Vorname" +msgstr "Firstname" + #: evapp/templates/evapp/employee_form.html:36 msgid "WARNUNG! Test-MODUS aktiviert. Es werden keine Mails verschickt!" msgstr "ATTENTION! Test mode activated. No mails will be send."