This commit is contained in:
Julien Palard 2023-12-20 17:09:36 +01:00
parent 83a532db5b
commit 8285744dcb
Signed by: mdk
GPG Key ID: 0EFC1AC1006886F8
6 changed files with 89 additions and 1 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ db.sqlite3
*.webm
.venv
.envrc
*.mo

View File

@ -12,6 +12,9 @@ https://docs.djangoproject.com/en/5.0/ref/settings/
from pathlib import Path
from django.utils.translation import gettext_lazy as _
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
@ -43,6 +46,7 @@ INSTALLED_APPS = [
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
@ -124,6 +128,12 @@ MEDIA_URL = 'media/'
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
LANGUAGES = [
("fr", _("French")),
("en", _("English")),
]
try:
from local_settings import *
except ImportError:

View File

@ -0,0 +1,27 @@
# 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 <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-20 15:58+0000\n"
"PO-Revision-Date: 2023-12-20 16:59+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\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 3.4.1\n"
#: eqy_fr/settings.py:132
msgid "French"
msgstr "Français"
#: eqy_fr/settings.py:133
msgid "English"
msgstr "Anglais"

View File

@ -0,0 +1,37 @@
# 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 <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-20 15:58+0000\n"
"PO-Revision-Date: 2023-12-20 17:00+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\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 3.4.1\n"
#: photos/templates/photos/index.html:13
msgid "This is the subtitle."
msgstr "Ceci est un sous-titre."
#: photos/templates/photos/index.html:27
msgid ""
"\n"
" Blah blah blah blah blah blah\n"
" "
msgstr ""
"\n"
" Bouhaha Brouhaha brouhaha\n"
" "
#: photos/views.py:8
msgid "Title"
msgstr "Titre"

View File

@ -1,3 +1,5 @@
{% load i18n %}
<!DOCTYPE html>
<html lang="fr">
<head>
@ -6,6 +8,10 @@
<title>photos</title>
</head>
<body>
<header>
<h1>{{title}}</h1>
<h2>{% translate "This is the subtitle." %}</h2>
</header>
<main>
{% for media in medias %}
<section>
@ -17,5 +23,10 @@
</section>
{% endfor %}
</main>
<footer>
{% blocktranslate %}
Blah blah blah blah blah blah
{% endblocktranslate %}
</footer>
</body>
</html>

View File

@ -1,7 +1,9 @@
from django.shortcuts import render
from django.utils.translation import gettext as _
from photos.models import Media
def index(request):
return render(request, "photos/index.html", context={"medias": Media.objects.all()})
title = _("Title")
return render(request, "photos/index.html", context={"title": title, "medias": Media.objects.all()})