i18n
This commit is contained in:
parent
83a532db5b
commit
8285744dcb
|
@ -4,3 +4,4 @@ db.sqlite3
|
||||||
*.webm
|
*.webm
|
||||||
.venv
|
.venv
|
||||||
.envrc
|
.envrc
|
||||||
|
*.mo
|
||||||
|
|
|
@ -12,6 +12,9 @@ https://docs.djangoproject.com/en/5.0/ref/settings/
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
|
||||||
|
@ -43,6 +46,7 @@ INSTALLED_APPS = [
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
'django.middleware.security.SecurityMiddleware',
|
'django.middleware.security.SecurityMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.locale.LocaleMiddleware',
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
'django.middleware.csrf.CsrfViewMiddleware',
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
@ -124,6 +128,12 @@ MEDIA_URL = 'media/'
|
||||||
|
|
||||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
|
|
||||||
|
LANGUAGES = [
|
||||||
|
("fr", _("French")),
|
||||||
|
("en", _("English")),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from local_settings import *
|
from local_settings import *
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
|
@ -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"
|
|
@ -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"
|
|
@ -1,3 +1,5 @@
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="fr">
|
<html lang="fr">
|
||||||
<head>
|
<head>
|
||||||
|
@ -6,6 +8,10 @@
|
||||||
<title>photos</title>
|
<title>photos</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<header>
|
||||||
|
<h1>{{title}}</h1>
|
||||||
|
<h2>{% translate "This is the subtitle." %}</h2>
|
||||||
|
</header>
|
||||||
<main>
|
<main>
|
||||||
{% for media in medias %}
|
{% for media in medias %}
|
||||||
<section>
|
<section>
|
||||||
|
@ -17,5 +23,10 @@
|
||||||
</section>
|
</section>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</main>
|
</main>
|
||||||
|
<footer>
|
||||||
|
{% blocktranslate %}
|
||||||
|
Blah blah blah blah blah blah
|
||||||
|
{% endblocktranslate %}
|
||||||
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from photos.models import Media
|
from photos.models import Media
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
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()})
|
||||||
|
|
Loading…
Reference in New Issue