From 8cdb578277ef832b9ad34febb57f180a3e6ddb31 Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Sun, 29 Oct 2023 20:19:50 +0100 Subject: [PATCH] La langue est prise en compte, traduction fonctionnelle --- .../locale/fr_FR/LC_MESSAGES/django.po | 134 ------------------ src/agenda_culturel/settings/base.py | 10 +- .../agenda_culturel/page-events.html | 14 +- .../templates/agenda_culturel/page.html | 2 +- src/agenda_culturel/views.py | 24 ++-- 5 files changed, 35 insertions(+), 149 deletions(-) delete mode 100644 src/agenda_culturel/locale/fr_FR/LC_MESSAGES/django.po diff --git a/src/agenda_culturel/locale/fr_FR/LC_MESSAGES/django.po b/src/agenda_culturel/locale/fr_FR/LC_MESSAGES/django.po deleted file mode 100644 index 56b93b6..0000000 --- a/src/agenda_culturel/locale/fr_FR/LC_MESSAGES/django.po +++ /dev/null @@ -1,134 +0,0 @@ -# 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: 2023-10-14 15:29+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" - -#: agenda_culturel/models.py:15 -msgid "Published" -msgstr "Publié" - -#: agenda_culturel/models.py:16 -msgid "Trash" -msgstr "Corbeille" - -#: agenda_culturel/models.py:17 -msgid "Draft" -msgstr "Brouillon" - -#: agenda_culturel/models.py:24 -msgid "Title" -msgstr "Titre" - -#: agenda_culturel/models.py:24 -msgid "Short title" -msgstr "Titre court" - -#: agenda_culturel/models.py:26 -msgid "Status" -msgstr "Status" - -#: agenda_culturel/models.py:28 -msgid "Day of the event" -msgstr "Date de l'événement" - -#: agenda_culturel/models.py:29 -msgid "Starting time" -msgstr "Heure de début" - -#: agenda_culturel/models.py:31 -msgid "End day of the event" -msgstr "Fin de l'événement" - -#: agenda_culturel/models.py:31 -msgid "End day of the event, only required if different from the start day." -msgstr "" -"Date de fin de l'événement, uniquement nécessaire s'il est différent du " -"premier jour de l'événement" - -#: agenda_culturel/models.py:32 -msgid "Final time" -msgstr "Heure de fin" - -#: agenda_culturel/models.py:34 -msgid "Location" -msgstr "Localisation" - -#: agenda_culturel/models.py:34 -msgid "Address of the event" -msgstr "Adresse de l'événement" - -#: agenda_culturel/models.py:36 -msgid "Description" -msgstr "Description" - -#: agenda_culturel/models.py:36 -msgid "General description of the event" -msgstr "Description générale de l'événement" - -#: agenda_culturel/models.py:38 -msgid "Illustration" -msgstr "Illustration" - -#: agenda_culturel/models.py:38 -msgid "URL of the illustration image" -msgstr "URL de l'image illustrative" - -#: agenda_culturel/models.py:39 -msgid "Illustration description" -msgstr "Description de l'illustration" - -#: agenda_culturel/models.py:39 -msgid "Alternative text used by screen readers for the image" -msgstr "Texte alternatif utiliser par les lecteurs d'écrans pour l'image" - -#: agenda_culturel/models.py:41 -msgid "URLs" -msgstr "URLs" - -#: agenda_culturel/models.py:41 -msgid "List of all the urls where this event can be found." -msgstr "Liste de toutes les urls où l'événement peut être trouvé." - -#: agenda_culturel/models.py:55 -msgid "Event" -msgstr "Événement" - -#: agenda_culturel/models.py:56 -msgid "Events" -msgstr "Événements" - -#: agenda_culturel/views.py:11 -msgid "this_week" -msgstr "cette_semaine" - -#: agenda_culturel/views.py:12 -msgid "this_weekend" -msgstr "ce_weekend" - -#: agenda_culturel/views.py:13 -msgid "next_week" -msgstr "semaine_prochaine" - -#: agenda_culturel/views.py:14 -msgid "this_month" -msgstr "ce_mois_ci" - -#: agenda_culturel/views.py:15 -#, fuzzy -#| msgid "next_mont" -msgid "next_month" -msgstr "mois_prochain" diff --git a/src/agenda_culturel/settings/base.py b/src/agenda_culturel/settings/base.py index 8271698..100c022 100644 --- a/src/agenda_culturel/settings/base.py +++ b/src/agenda_culturel/settings/base.py @@ -1,5 +1,6 @@ from os import getenv as os_getenv, path as os_path # noqa from pathlib import Path +from django.utils.translation import gettext_lazy as _ from django.core.management.utils import get_random_secret_key @@ -45,6 +46,7 @@ MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", "whitenoise.middleware.WhiteNoiseMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", + 'django.middleware.locale.LocaleMiddleware', "corsheaders.middleware.CorsMiddleware", # CorsMiddleware should be placed as high as possible, "django.middleware.common.CommonMiddleware", "django.middleware.csrf.CsrfViewMiddleware", @@ -108,7 +110,7 @@ AUTH_PASSWORD_VALIDATORS = [ # Internationalization # https://docs.djangoproject.com/en/4.2/topics/i18n/ -LANGUAGE_CODE = "fr-fr" +LANGUAGE_CODE = "fr" TIME_ZONE = "Europe/Paris" @@ -116,6 +118,12 @@ USE_I18N = True USE_TZ = True +LANGUAGES = ( + ('en-us', _('English')), + ('fr', _('French')), +) + + # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/4.2/howto/static-files/ diff --git a/src/agenda_culturel/templates/agenda_culturel/page-events.html b/src/agenda_culturel/templates/agenda_culturel/page-events.html index c94b6f8..eaa7895 100644 --- a/src/agenda_culturel/templates/agenda_culturel/page-events.html +++ b/src/agenda_culturel/templates/agenda_culturel/page-events.html @@ -1,5 +1,9 @@ {% extends "agenda_culturel/page.html" %} + + +{% load i18n %} + {% load cat_extra %} {% block entete_header %} @@ -10,7 +14,7 @@
- {% block events %}{% endblock %} + {% block events %} +

{{ selected_mode | capfirst }}

+ {% endblock %}