From cf33b95201a87c7dfe97f934e5c6038debdf54ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Sun, 28 Feb 2021 23:55:01 +0100 Subject: [PATCH] Getting ready for some translations. --- .gitignore | 3 +- Dockerfile | 1 + Makefile | 3 + entrypoint.sh | 5 +- src/project/locale/da/LC_MESSAGES/django.po | 504 ++++++++++++++++++++ src/project/settings.py | 13 +- src/project/templates/account/email.html | 2 +- src/project/templates/account/login.html | 3 +- src/project/templates/account/signup.html | 2 +- 9 files changed, 527 insertions(+), 9 deletions(-) create mode 100644 src/project/locale/da/LC_MESSAGES/django.po diff --git a/.gitignore b/.gitignore index bf52361..cb12fcd 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ __pycache__/ *.pyc *.sw* db.sqlite3 -project/settings/local.py .pytest_cache +.idea/ +*.mo diff --git a/Dockerfile b/Dockerfile index 6cd196e..e1b4c28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,7 @@ RUN apt-get update \ libgdk-pixbuf2.0-0 \ libffi-dev \ shared-mime-info \ + gettext \ && pip install "poetry==$POETRY_VERSION" WORKDIR /app diff --git a/Makefile b/Makefile index 3afa9db..255a46c 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,9 @@ run: build: docker-compose build +makemessages: + ${MANAGE} makemessages -a + makemigrations: ${MANAGE} makemigrations ${EXTRA_ARGS} diff --git a/entrypoint.sh b/entrypoint.sh index bae76a8..4198614 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -11,10 +11,11 @@ done echo "PostgreSQL started" -# Only migrate and collectstatic if we are NOT in development +# Only migrate, collectstatic and compilemessages if we are NOT in development if [ -z "$DEBUG" ]; then - python manage.py migrate + python manage.py migrate; python manage.py collectstatic --no-input; + python manage.py compilemessages; fi exec "$@" diff --git a/src/project/locale/da/LC_MESSAGES/django.po b/src/project/locale/da/LC_MESSAGES/django.po new file mode 100644 index 0000000..3e1392b --- /dev/null +++ b/src/project/locale/da/LC_MESSAGES/django.po @@ -0,0 +1,504 @@ +# 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. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-02-28 23:54+0100\n" +"PO-Revision-Date: 2021-02-28 23:44+0100\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: da\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" +"X-Generator: Poedit 2.4.1\n" + +#: src/accounting/admin.py:15 src/accounting/admin.py:26 +msgid "Customer" +msgstr "" + +#: src/accounting/admin.py:31 +msgid "Order ID" +msgstr "" + +#: src/accounting/models.py:13 src/membership/models.py:11 +msgid "modified" +msgstr "" + +#: src/accounting/models.py:14 src/membership/models.py:12 +msgid "created" +msgstr "" + +#: src/accounting/models.py:43 +msgid "amount" +msgstr "" + +#: src/accounting/models.py:46 +msgid "This will include VAT" +msgstr "" + +#: src/accounting/models.py:48 src/accounting/models.py:61 +#: src/accounting/models.py:100 +msgid "description" +msgstr "" + +#: src/accounting/models.py:64 +msgid "price (excl. VAT)" +msgstr "" + +#: src/accounting/models.py:66 +msgid "VAT" +msgstr "" + +#: src/accounting/models.py:68 +msgid "is paid" +msgstr "" + +#: src/accounting/models.py:88 +msgctxt "accounting term" +msgid "Order" +msgstr "" + +#: src/accounting/models.py:89 +msgctxt "accounting term" +msgid "Orders" +msgstr "" + +#: src/accounting/models.py:121 +msgid "payment" +msgstr "" + +#: src/accounting/models.py:122 +msgid "payments" +msgstr "" + +#: src/membership/models.py:45 +msgid "membership" +msgstr "" + +#: src/membership/models.py:46 +msgid "memberships" +msgstr "" + +#: src/membership/models.py:53 +msgid "subscription type" +msgstr "" + +#: src/membership/models.py:57 +msgid "The duration this subscription is for. " +msgstr "" + +#: src/membership/models.py:70 +msgid "membership type" +msgstr "" + +#: src/membership/models.py:71 +msgid "membership types" +msgstr "" + +#: src/membership/models.py:73 +msgid "name" +msgstr "" + +#: src/membership/templates/membership_overview.html:7 +msgid "You do not have an active membership!" +msgstr "" + +#: src/membership/templates/membership_overview.html:9 +msgid "" +"You can become a member by depositing the membership fee to our bank account." +msgstr "" + +#: src/membership/templates/membership_overview.html:17 +msgid "You are a member!" +msgstr "" + +#: src/membership/templates/membership_overview.html:19 +msgid "Period" +msgstr "Periode" + +#: src/membership/templates/membership_overview.html:20 +msgid "Type" +msgstr "Type" + +#: src/project/settings.py:118 +msgid "Danish" +msgstr "" + +#: src/project/settings.py:119 +msgid "English" +msgstr "" + +#: src/project/templates/account/account_inactive.html:5 +#: src/project/templates/account/account_inactive.html:8 +msgid "Account Inactive" +msgstr "Inaktiv konto" + +#: src/project/templates/account/account_inactive.html:10 +msgid "This account is inactive." +msgstr "Denne konto er inaktiv." + +#: src/project/templates/account/email.html:5 +#: src/project/templates/account/email.html:16 +msgid "E-mail Addresses" +msgstr "E-mail adresser" + +#: src/project/templates/account/email.html:21 +msgid "The following e-mail addresses are associated with your account:" +msgstr "De følgende e-mail adresser er tilknyttet din konto:" + +#: src/project/templates/account/email.html:31 +msgid "Address" +msgstr "Adresse" + +#: src/project/templates/account/email.html:32 +msgid "Status" +msgstr "Status" + +#: src/project/templates/account/email.html:33 +msgid "Primary" +msgstr "Primær" + +#: src/project/templates/account/email.html:90 +msgid "Warning:" +msgstr "Advarsel:" + +#: src/project/templates/account/email.html:91 +msgid "" +"You currently do not have any e-mail address set up. You should really add " +"an e-mail address so you can receive notifications, reset your password, etc." +msgstr "" +"Du har lige nu ingen e-mail adresse tilknyttet. Du burde virkelig tilføje en " +"e-mail adresse så du kan modtage notifikationer, nulstille dit kodeord, osv." + +#: src/project/templates/account/email.html:99 +#: src/project/templates/account/email.html:107 +msgid "Add E-mail" +msgstr "Tilføj e-mail" + +#: src/project/templates/account/email.html:118 +msgid "Do you really want to remove the selected e-mail address?" +msgstr "Vil du virkelig fjerne den valgte e-mail?" + +#: src/project/templates/account/email/base_message.txt:1 +#, python-format +msgid "Hello from %(site_name)s!" +msgstr "Hej fra %(site_name)s!" + +#: src/project/templates/account/email/base_message.txt:5 +#, python-format +msgid "" +"Thank you for using %(site_name)s!\n" +"%(site_domain)s" +msgstr "" + +#: src/project/templates/account/email/email_confirmation_message.txt:5 +#, python-format +msgid "" +"You're receiving this e-mail because user %(user_display)s has given your e-" +"mail address to register an account on %(site_domain)s.\n" +"\n" +"To confirm this is correct, go to %(activate_url)s" +msgstr "" + +#: src/project/templates/account/email/email_confirmation_subject.txt:3 +msgid "Please Confirm Your E-mail Address" +msgstr "Venligst bekræft din e-mail adresse" + +#: src/project/templates/account/email/password_reset_key_message.txt:4 +msgid "" +"You're receiving this e-mail because you or someone else has requested a " +"password for your user account.\n" +"It can be safely ignored if you did not request a password reset. Click the " +"link below to reset your password." +msgstr "" + +#: src/project/templates/account/email/password_reset_key_message.txt:9 +#, python-format +msgid "In case you forgot, your username is %(username)s." +msgstr "" + +#: src/project/templates/account/email/password_reset_key_subject.txt:3 +msgid "Password Reset E-mail" +msgstr "" + +#: src/project/templates/account/email_confirm.html:6 +#: src/project/templates/account/email_confirm.html:10 +msgid "Confirm E-mail Address" +msgstr "Bekræft e-mail adresse" + +#: src/project/templates/account/email_confirm.html:16 +#, python-format +msgid "" +"Please confirm that %(email)s is an e-mail " +"address for user %(user_display)s." +msgstr "" + +#: src/project/templates/account/email_confirm.html:20 +msgid "Confirm" +msgstr "Bekræft" + +#: src/project/templates/account/email_confirm.html:27 +#, python-format +msgid "" +"This e-mail confirmation link expired or is invalid. Please issue a new e-mail confirmation request." +msgstr "" + +#: src/project/templates/account/login.html:22 +#: src/project/templates/account/login.html:28 +msgid "Username/e-mail" +msgstr "" + +#: src/project/templates/account/login.html:33 +#: src/project/templates/account/login.html:39 +#: src/project/templates/account/signup.html:44 +#: src/project/templates/account/signup.html:50 +msgid "Password" +msgstr "Kodeord" + +#: src/project/templates/account/login.html:43 +msgid "Sign in" +msgstr "Log ind" + +#: src/project/templates/account/login.html:46 +msgid "Or" +msgstr "Eller" + +#: src/project/templates/account/login.html:51 +#: src/project/templates/account/signup.html:8 +msgid "Become a member" +msgstr "Bliv medlem" + +#: src/project/templates/account/logout.html:5 +#: src/project/templates/account/logout.html:8 +#: src/project/templates/account/logout.html:17 +msgid "Sign Out" +msgstr "Log ud" + +#: src/project/templates/account/logout.html:10 +msgid "Are you sure you want to sign out?" +msgstr "Er du sikker på at du vil logge ind?" + +#: src/project/templates/account/messages/cannot_delete_primary_email.txt:2 +#, python-format +msgid "You cannot remove your primary e-mail address (%(email)s)." +msgstr "" + +#: src/project/templates/account/messages/email_confirmation_sent.txt:2 +#, python-format +msgid "Confirmation e-mail sent to %(email)s." +msgstr "" + +#: src/project/templates/account/messages/email_confirmed.txt:2 +#, python-format +msgid "You have confirmed %(email)s." +msgstr "" + +#: src/project/templates/account/messages/email_deleted.txt:2 +#, python-format +msgid "Removed e-mail address %(email)s." +msgstr "" + +#: src/project/templates/account/messages/logged_in.txt:4 +#, python-format +msgid "Successfully signed in as %(name)s." +msgstr "" + +#: src/project/templates/account/messages/logged_out.txt:2 +msgid "You have signed out." +msgstr "Du er nu logget ud." + +#: src/project/templates/account/messages/password_changed.txt:2 +msgid "Password successfully changed." +msgstr "" + +#: src/project/templates/account/messages/password_set.txt:2 +msgid "Password successfully set." +msgstr "" + +#: src/project/templates/account/messages/primary_email_set.txt:2 +msgid "Primary e-mail address set." +msgstr "" + +#: src/project/templates/account/messages/unverified_primary_email.txt:2 +msgid "Your primary e-mail address must be verified." +msgstr "" + +#: src/project/templates/account/password_change.html:5 +#: src/project/templates/account/password_change.html:8 +#: src/project/templates/account/password_change.html:13 +#: src/project/templates/account/password_reset_from_key.html:4 +#: src/project/templates/account/password_reset_from_key.html:7 +#: src/project/templates/account/password_reset_from_key_done.html:4 +#: src/project/templates/account/password_reset_from_key_done.html:7 +msgid "Change Password" +msgstr "Skift kodeord" + +#: src/project/templates/account/password_change.html:14 +msgid "Forgot Password?" +msgstr "Glemt kodeord?" + +#: src/project/templates/account/password_reset.html:6 +#: src/project/templates/account/password_reset.html:10 +#: src/project/templates/account/password_reset_done.html:6 +#: src/project/templates/account/password_reset_done.html:9 +msgid "Password Reset" +msgstr "" + +#: src/project/templates/account/password_reset.html:15 +msgid "" +"Forgotten your password? Enter your e-mail address below, and we'll send you " +"an e-mail allowing you to reset it." +msgstr "" + +#: src/project/templates/account/password_reset.html:20 +msgid "Reset My Password" +msgstr "" + +#: src/project/templates/account/password_reset.html:23 +msgid "Please contact us if you have any trouble resetting your password." +msgstr "" + +#: src/project/templates/account/password_reset_done.html:15 +msgid "" +"We have sent you an e-mail. Please contact us if you do not receive it " +"within a few minutes." +msgstr "" + +#: src/project/templates/account/password_reset_from_key.html:7 +msgid "Bad Token" +msgstr "" + +#: src/project/templates/account/password_reset_from_key.html:11 +#, python-format +msgid "" +"The password reset link was invalid, possibly because it has already been " +"used. Please request a new password reset." +msgstr "" + +#: src/project/templates/account/password_reset_from_key.html:17 +msgid "change password" +msgstr "" + +#: src/project/templates/account/password_reset_from_key.html:20 +#: src/project/templates/account/password_reset_from_key_done.html:8 +msgid "Your password is now changed." +msgstr "" + +#: src/project/templates/account/password_set.html:5 +#: src/project/templates/account/password_set.html:8 +#: src/project/templates/account/password_set.html:13 +msgid "Set Password" +msgstr "Sæt kodeord" + +#: src/project/templates/account/signup.html:26 +#: src/project/templates/account/signup.html:32 +msgid "E-mail" +msgstr "E-mail" + +#: src/project/templates/account/signup.html:66 +msgid "Sign up" +msgstr "Bliv medlem" + +#: src/project/templates/account/signup.html:72 +msgid "To login" +msgstr "Til login" + +#: src/project/templates/account/signup_closed.html:5 +#: src/project/templates/account/signup_closed.html:8 +msgid "Sign Up Closed" +msgstr "" + +#: src/project/templates/account/signup_closed.html:10 +msgid "We are sorry, but the sign up is currently closed." +msgstr "" + +#: src/project/templates/account/snippets/already_logged_in.html:5 +msgid "Note" +msgstr "" + +#: src/project/templates/account/snippets/already_logged_in.html:5 +#, python-format +msgid "you are already logged in as %(user_display)s." +msgstr "" + +#: src/project/templates/account/verification_sent.html:5 +#: src/project/templates/account/verification_sent.html:8 +#: src/project/templates/account/verified_email_required.html:5 +#: src/project/templates/account/verified_email_required.html:8 +msgid "Verify Your E-mail Address" +msgstr "Verificér din e-mail adresse" + +#: src/project/templates/account/verification_sent.html:10 +msgid "" +"We have sent an e-mail to you for verification. Follow the link provided to " +"finalize the signup process. Please contact us if you do not receive it " +"within a few minutes." +msgstr "" + +#: src/project/templates/account/verified_email_required.html:12 +msgid "" +"This part of the site requires us to verify that\n" +"you are who you claim to be. For this purpose, we require that you\n" +"verify ownership of your e-mail address. " +msgstr "" + +#: src/project/templates/account/verified_email_required.html:16 +msgid "" +"We have sent an e-mail to you for\n" +"verification. Please click on the link inside this e-mail. Please\n" +"contact us if you do not receive it within a few minutes." +msgstr "" + +#: src/project/templates/account/verified_email_required.html:20 +#, python-format +msgid "" +"Note: you can still change your e-" +"mail address." +msgstr "" + +#: src/project/templates/base.html:140 +msgid "Dashboard" +msgstr "" + +#: src/project/templates/base.html:146 +msgid "Profile" +msgstr "Profil" + +#: src/project/templates/base.html:152 +msgid "Details" +msgstr "Detaljer" + +#: src/project/templates/base.html:158 +msgid "Emails" +msgstr "Emails" + +#: src/project/templates/base.html:164 +msgid "Membership" +msgstr "Medlemskab" + +#: src/project/templates/base.html:171 src/project/templates/base.html:184 +msgid "Overview" +msgstr "Oversigt" + +#: src/project/templates/base.html:177 +msgid "Services" +msgstr "Tjenester" + +#: src/project/templates/base.html:191 +msgid "Admin" +msgstr "Admin" + +#: src/project/templates/base.html:197 +msgid "Members" +msgstr "Medlemmer" + +#~ msgid "OR" +#~ msgstr "Eller" diff --git a/src/project/settings.py b/src/project/settings.py index 4c7d2ab..9b251a7 100644 --- a/src/project/settings.py +++ b/src/project/settings.py @@ -1,5 +1,6 @@ from pathlib import Path +from django.utils.translation import gettext_lazy as _ from environs import Env env = Env() @@ -8,6 +9,7 @@ env.read_env() # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent +PROJECT_DIR = BASE_DIR / "project" SECRET_KEY = env.str("SECRET_KEY", default="something-very-secret") @@ -52,7 +54,7 @@ ROOT_URLCONF = "project.urls" TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [BASE_DIR / "project" / "templates"], + "DIRS": [PROJECT_DIR / "templates"], "APP_DIRS": True, "OPTIONS": { "context_processors": [ @@ -94,7 +96,7 @@ USE_TZ = True STATIC_URL = "/static/" -STATICFILES_DIRS = [BASE_DIR / "project" / "static"] +STATICFILES_DIRS = [PROJECT_DIR / "static"] SITE_ID = 1 @@ -112,6 +114,13 @@ DEBUG_TOOLBAR_CONFIG = { CURRENCIES = ("DKK",) CURRENCY_CHOICES = [("DKK", "DKK")] +LANGUAGES = [ + ("da", _("Danish")), + ("en", _("English")), +] + +# We store all translations in one location +LOCALE_PATHS = [PROJECT_DIR / "locale"] # Allauth configuration ACCOUNT_AUTHENTICATION_METHOD = "email" diff --git a/src/project/templates/account/email.html b/src/project/templates/account/email.html index bd8d578..9010491 100644 --- a/src/project/templates/account/email.html +++ b/src/project/templates/account/email.html @@ -96,7 +96,7 @@
-

{% trans "Add E-mail Address" %}

+

{% trans "Add E-mail" %}

-{#

{% trans "" %}

#} {% if form.non_field_errors %} {% for error in form.non_field_errors %} @@ -44,7 +43,7 @@ type="submit">{% trans "Sign in" %}
-
+
- {% trans "Back to login" %} + {% trans "To login" %} {% endblock %}