From ccbf1b7d36ae9e7f9eb9e6fc94771e0924d84f8b Mon Sep 17 00:00:00 2001 From: loulous27 Date: Sat, 22 Nov 2025 23:04:59 +0100 Subject: [PATCH 1/2] JS Translation --- photo21/templates/base.html | 1 + photo21/urls.py | 2 ++ photologue/locale/de/LC_MESSAGES/djangojs.po | 30 +++++++++++++++++++ photologue/locale/es/LC_MESSAGES/djangojs.po | 31 ++++++++++++++++++++ photologue/locale/fr/LC_MESSAGES/djangojs.po | 30 +++++++++++++++++++ photologue/static/upload.js | 8 ++--- 6 files changed, 98 insertions(+), 4 deletions(-) create mode 100644 photologue/locale/de/LC_MESSAGES/djangojs.po create mode 100644 photologue/locale/es/LC_MESSAGES/djangojs.po create mode 100644 photologue/locale/fr/LC_MESSAGES/djangojs.po diff --git a/photo21/templates/base.html b/photo21/templates/base.html index 35ce854..66ea520 100644 --- a/photo21/templates/base.html +++ b/photo21/templates/base.html @@ -132,6 +132,7 @@ SPDX-License-Identifier: GPL-3.0-or-later + {% block extrajs %}{% endblock %} diff --git a/photo21/urls.py b/photo21/urls.py index 8c4d5dd..3a1cb1e 100644 --- a/photo21/urls.py +++ b/photo21/urls.py @@ -12,6 +12,7 @@ from django.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.urls import include, path, re_path +from django.views.i18n import JavaScriptCatalog from .views import IndexView, MediaAccess @@ -20,6 +21,7 @@ urlpatterns = [ path("", include("photologue.urls", namespace="photologue")), path("accounts/", include("allauth.urls")), path("i18n/", include("django.conf.urls.i18n")), + path('jsi18n/', JavaScriptCatalog.as_view(), name='javascript-catalog'), path("admin/doc/", include("django.contrib.admindocs.urls")), path("admin/", admin.site.urls), ] diff --git a/photologue/locale/de/LC_MESSAGES/djangojs.po b/photologue/locale/de/LC_MESSAGES/djangojs.po new file mode 100644 index 0000000..c2c1c0a --- /dev/null +++ b/photologue/locale/de/LC_MESSAGES/djangojs.po @@ -0,0 +1,30 @@ +# 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: 2025-11-22 22:53+0100\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" +#: .\photologue\static\upload.js:52 +msgid "Continious Upload" +msgstr "Kontinuierlicher Upload" + +#: .\photologue\static\upload.js:62 .\photologue\static\upload.js:113 +msgid "Please be patient" +msgstr "Please be patient" + +#: .\photologue\static\upload.js:139 +msgid "Upload Complete Please reload the page" +msgstr "Upload abgeschlossen. Bitte laden Sie die Seite neu." diff --git a/photologue/locale/es/LC_MESSAGES/djangojs.po b/photologue/locale/es/LC_MESSAGES/djangojs.po new file mode 100644 index 0000000..71cd3c0 --- /dev/null +++ b/photologue/locale/es/LC_MESSAGES/djangojs.po @@ -0,0 +1,31 @@ +# 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: 2025-11-22 22:53+0100\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=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? " +"1 : 2;\n" +#: .\photologue\static\upload.js:52 +msgid "Continious Upload" +msgstr "Carga continua" + +#: .\photologue\static\upload.js:62 .\photologue\static\upload.js:113 +msgid "Please be patient" +msgstr "por favor tenga paciencia" + +#: .\photologue\static\upload.js:139 +msgid "Upload Complete Please reload the page" +msgstr "Carga completa Por favor recarga la página" diff --git a/photologue/locale/fr/LC_MESSAGES/djangojs.po b/photologue/locale/fr/LC_MESSAGES/djangojs.po new file mode 100644 index 0000000..63b80e4 --- /dev/null +++ b/photologue/locale/fr/LC_MESSAGES/djangojs.po @@ -0,0 +1,30 @@ +# 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 , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-11-22 22:53+0100\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" +#: .\photologue\static\upload.js:52 +msgid "Continious Upload" +msgstr "Téléversement Continu" + +#: .\photologue\static\upload.js:62 .\photologue\static\upload.js:113 +msgid "Please be patient" +msgstr "Merci d'être patient" + +#: .\photologue\static\upload.js:139 +msgid "Upload Complete Please reload the page" +msgstr "Téléversement terminé Merci de recharger la page" diff --git a/photologue/static/upload.js b/photologue/static/upload.js index 23a927e..444189e 100644 --- a/photologue/static/upload.js +++ b/photologue/static/upload.js @@ -49,7 +49,7 @@ submitbtn = document.getElementById('submit-id-submit'); var ctnbtn = document.createElement("input"); ctnbtn.classList = submitbtn.classList; -ctnbtn.value="Continious Upload"; +ctnbtn.value=gettext("Continious Upload"); ctnbtn.type = "button"; async function uplaodfnc() { @@ -59,7 +59,7 @@ async function uplaodfnc() { submitbtn.disabled = true; ctnbtn.disabled = true; actual = 0; - ctnbtn.value = "Please be patient 0% (" + actual + "/" + files.length + ")"; + ctnbtn.value = gettext("Please be patient")+" 0% (" + actual + "/" + files.length + ")"; csrfvalue = document.getElementsByName("csrfmiddlewaretoken")[0].value; @@ -110,7 +110,7 @@ async function uplaodfnc() { if (!okpass) { window.alert("Error with " + file.name + "code" + await response.code); } - ctnbtn.value = "Please be patient " + Math.round(100 * actual / total) + "% (" + actual + "/" + files.length + ")"; + ctnbtn.value = gettext("Please be patient")+" " + Math.round(100 * actual / total) + "% (" + actual + "/" + files.length + ")"; } catch (e) { console.error(e); @@ -136,7 +136,7 @@ async function uplaodfnc() { }); returned = await response.json(); - ctnbtn.value = "Upload Complete Please reload the page"; + ctnbtn.value = gettext("Upload Complete Please reload the page"); } From 31ec789300b457b02f8f44090c843749cf81c310 Mon Sep 17 00:00:00 2001 From: loulous27 Date: Sun, 23 Nov 2025 09:29:23 +0100 Subject: [PATCH 2/2] Corrections --- photo21/settings.py | 10 +++++----- photologue/locale/es/LC_MESSAGES/djangojs.po | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/photo21/settings.py b/photo21/settings.py index 2892898..556b297 100644 --- a/photo21/settings.py +++ b/photo21/settings.py @@ -205,12 +205,12 @@ MESSAGE_TAGS = { messages.ERROR: "alert-danger", } -# Allauth configuration -# ACCOUNT_EMAIL_REQUIRED = True -ACCOUNT_SIGNUP_FIELDS = ['email*', 'username*', 'password1*', 'password2*'] +# Allauth configuration ## For the django =< 5.0 +ACCOUNT_EMAIL_REQUIRED = True +# ACCOUNT_SIGNUP_FIELDS = ['email*', 'username*', 'password1*', 'password2*'] ## For the django =< 5.0 ACCOUNT_EMAIL_VERIFICATION = "mandatory" -# ACCOUNT_AUTHENTICATION_METHOD = "username_email" -ACCOUNT_LOGIN_METHODS = {'username', 'email'} +ACCOUNT_AUTHENTICATION_METHOD = "username_email" +# ACCOUNT_LOGIN_METHODS = {'username', 'email'} ACCOUNT_FORMS = {"signup": "photo21.forms.CustomSignupForm"} SOCIALACCOUNT_PROVIDERS = { "notekfet": { diff --git a/photologue/locale/es/LC_MESSAGES/djangojs.po b/photologue/locale/es/LC_MESSAGES/djangojs.po index 71cd3c0..ad61221 100644 --- a/photologue/locale/es/LC_MESSAGES/djangojs.po +++ b/photologue/locale/es/LC_MESSAGES/djangojs.po @@ -24,7 +24,7 @@ msgstr "Carga continua" #: .\photologue\static\upload.js:62 .\photologue\static\upload.js:113 msgid "Please be patient" -msgstr "por favor tenga paciencia" +msgstr "espera por favor" #: .\photologue\static\upload.js:139 msgid "Upload Complete Please reload the page"