From d134c0049dbec8af0ee0712e36aa9cdce4f5b13e Mon Sep 17 00:00:00 2001 From: Christian Wiegand Date: Mon, 29 Aug 2022 00:22:50 +0200 Subject: [PATCH] Localization (#214) * General localization: - Add gettext to literals - Add trans template tag to templates - Set localized date and time - Add locale option to TEMPLATE.env - Add migrations that result from model field changes * Add german locale * Add german locale --- TEMPLATE.env | 4 + shynet/a17t/locale/de/LC_MESSAGES/django.po | 29 + .../a17t/templates/a17t/includes/label.html | 3 +- .../templates/a17t/includes/pagination.html | 9 +- .../analytics/locale/de/LC_MESSAGES/django.po | 118 +++ .../migrations/0010_auto_20220624_0744.py | 114 +++ shynet/analytics/models.py | 61 +- shynet/core/locale/de/LC_MESSAGES/django.po | 87 +++ shynet/core/locale/en/LC_MESSAGES/django.po | 247 ------- .../migrations/0009_auto_20220624_0744.py | 90 +++ shynet/core/models.py | 36 +- shynet/dashboard/forms.py | 36 +- .../dashboard/locale/de/LC_MESSAGES/django.po | 698 ++++++++++++++++++ shynet/dashboard/templates/base.html | 17 +- .../dashboard/includes/date_range.html | 15 +- .../dashboard/includes/service_form.html | 4 +- .../dashboard/includes/service_overview.html | 10 +- .../dashboard/includes/session_list.html | 16 +- .../dashboard/includes/sidebar_portal.html | 6 +- .../templates/dashboard/pages/dashboard.html | 4 +- .../templates/dashboard/pages/index.html | 5 +- .../templates/dashboard/pages/service.html | 58 +- .../dashboard/pages/service_create.html | 10 +- .../dashboard/pages/service_delete.html | 10 +- .../dashboard/pages/service_session.html | 25 +- .../dashboard/pages/service_session_list.html | 6 +- .../dashboard/pages/service_update.html | 22 +- shynet/shynet/settings.py | 3 +- 28 files changed, 1348 insertions(+), 395 deletions(-) create mode 100644 shynet/a17t/locale/de/LC_MESSAGES/django.po create mode 100644 shynet/analytics/locale/de/LC_MESSAGES/django.po create mode 100644 shynet/analytics/migrations/0010_auto_20220624_0744.py create mode 100644 shynet/core/locale/de/LC_MESSAGES/django.po delete mode 100644 shynet/core/locale/en/LC_MESSAGES/django.po create mode 100644 shynet/core/migrations/0009_auto_20220624_0744.py create mode 100644 shynet/dashboard/locale/de/LC_MESSAGES/django.po diff --git a/TEMPLATE.env b/TEMPLATE.env index aead45c..cefdbf0 100644 --- a/TEMPLATE.env +++ b/TEMPLATE.env @@ -29,6 +29,10 @@ DJANGO_SECRET_KEY=random_string # For better security, set this to your deployment's domain. Comma separated. ALLOWED_HOSTS=* +# Localization +# https://docs.djangoproject.com/en/2.2/topics/i18n/ +LANGUAGE_CODE=en-us + # Set to True (capitalized) if you want people to be able to sign up for your Shynet instance (not recommended) ACCOUNT_SIGNUPS_ENABLED=False diff --git a/shynet/a17t/locale/de/LC_MESSAGES/django.po b/shynet/a17t/locale/de/LC_MESSAGES/django.po new file mode 100644 index 0000000..b8018ad --- /dev/null +++ b/shynet/a17t/locale/de/LC_MESSAGES/django.po @@ -0,0 +1,29 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-06-24 13:20+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \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" + +#: a17t/templates/a17t/includes/pagination.html:5 +#: a17t/templates/a17t/includes/pagination.html:7 +msgid "Previous" +msgstr "Zurück" + +#: a17t/templates/a17t/includes/pagination.html:10 +#: a17t/templates/a17t/includes/pagination.html:12 +msgid "Next" +msgstr "Vor" diff --git a/shynet/a17t/templates/a17t/includes/label.html b/shynet/a17t/templates/a17t/includes/label.html index 59184d1..442e9d5 100644 --- a/shynet/a17t/templates/a17t/includes/label.html +++ b/shynet/a17t/templates/a17t/includes/label.html @@ -1 +1,2 @@ - \ No newline at end of file +{% load i18n %} + \ No newline at end of file diff --git a/shynet/a17t/templates/a17t/includes/pagination.html b/shynet/a17t/templates/a17t/includes/pagination.html index 4d2284d..47814af 100644 --- a/shynet/a17t/templates/a17t/includes/pagination.html +++ b/shynet/a17t/templates/a17t/includes/pagination.html @@ -1,14 +1,15 @@ +{% load i18n %}