diff --git a/lg/__init__.py b/lg/__init__.py index e69de29..ae27a2a 100644 --- a/lg/__init__.py +++ b/lg/__init__.py @@ -0,0 +1 @@ +default_app_config = 'lg.apps.LgConfig' diff --git a/lglog/settings.py b/lglog/settings.py index dceb59c..933c837 100644 --- a/lglog/settings.py +++ b/lglog/settings.py @@ -49,6 +49,8 @@ MIDDLEWARE = [ 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'django.middleware.locale.LocaleMiddleware', + 'django.contrib.sites.middleware.CurrentSiteMiddleware', ] ROOT_URLCONF = 'lglog.urls' @@ -56,7 +58,7 @@ ROOT_URLCONF = 'lglog.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [BASE_DIR / 'templates'], + 'DIRS': [BASE_DIR / 'lglog/templates'], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ @@ -105,7 +107,13 @@ AUTH_PASSWORD_VALIDATORS = [ # Internationalization # https://docs.djangoproject.com/en/3.1/topics/i18n/ -LANGUAGE_CODE = 'fr' +LANGUAGE_CODE = 'en' + +from django.utils.translation import gettext_lazy as _ +LANGUAGES = [ + ('en', _('English')), + ('fr', _('French')), +] TIME_ZONE = 'Europe/Paris' diff --git a/lglog/templates/base.html b/lglog/templates/base.html new file mode 100644 index 0000000..f2ab89c --- /dev/null +++ b/lglog/templates/base.html @@ -0,0 +1,107 @@ +{% load static i18n static %} + + +{% get_current_language as LANGUAGE_CODE %}{% get_current_language_bidi as LANGUAGE_BIDI %} + + + + + + {% block title %}{{ title }}{% endblock title %} - Historique loup-garou + + + + {# Favicon #} + + + {% if no_cache %} + + {% endif %} + + {# Bootstrap CSS #} + + + + + {# JQuery, Bootstrap and Turbolinks JavaScript #} + + + + + + {# Si un formulaire requiert des données supplémentaires (notamment JS), les données sont chargées #} + {% if form.media %} + {{ form.media }} + {% endif %} + + {% block extracss %}{% endblock %} + + +
+ + {% block fullcontent %} +
+ {% block contenttitle %}{% endblock %} +
+
+ {% block content %} +

Default content...

+ {% endblock content %} +
+
+ {% endblock %} +
+ + + + + +{% block extrajavascript %}{% endblock %} + + diff --git a/lglog/templates/base_modal.html b/lglog/templates/base_modal.html new file mode 100644 index 0000000..ab9cf2a --- /dev/null +++ b/lglog/templates/base_modal.html @@ -0,0 +1,24 @@ +{% load i18n %} + + \ No newline at end of file diff --git a/lglog/templates/index.html b/lglog/templates/index.html new file mode 100644 index 0000000..b49cc26 --- /dev/null +++ b/lglog/templates/index.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} + +{% load i18n %} + +{% block title %}{% trans "Index" %}{% endblock %} + +{% block content %} + Historique de loup-garou +{% endblock %} diff --git a/lglog/urls.py b/lglog/urls.py index dfc7362..4c45a70 100644 --- a/lglog/urls.py +++ b/lglog/urls.py @@ -1,6 +1,13 @@ from django.contrib import admin -from django.urls import path +from django.contrib.auth.views import LoginView +from django.urls import path, include +from django.views.generic import TemplateView urlpatterns = [ - path('admin/', admin.site.urls), + path('', TemplateView.as_view(template_name="index.html"), name="index"), + path('admin/', admin.site.urls, name="admin"), + path('admin/doc/', include('django.contrib.admindocs.urls')), + path('i18n/', include('django.conf.urls.i18n')), + path('accounts/login/', LoginView.as_view()), + path('accounts/', include('django.contrib.auth.urls')), ] diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po new file mode 100644 index 0000000..be04605 --- /dev/null +++ b/locale/fr/LC_MESSAGES/django.po @@ -0,0 +1,212 @@ +# LG Log translation file +# Copyright (C) 2020 ynerant +# This file is distributed under the same license as the PACKAGE package. +# Yohann D'ANELLO , 2020. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-11-15 21:17+0100\n" +"PO-Revision-Date: 2020-11-15 21:12+0100\n" +"Last-Translator: Yohann D'ANELLO \n" +"Language-Team: FR \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" + +#: lg/models.py:11 +msgid "user" +msgstr "utilisateur" + +#: lg/models.py:16 +msgid "dead" +msgstr "mort" + +#: lg/models.py:21 +msgid "infected" +msgstr "infecté" + +#: lg/models.py:26 +msgid "hacked" +msgstr "hacké" + +#: lg/models.py:31 +msgid "captain" +msgstr "capitaine" + +#: lg/models.py:50 lg/models.py:112 +msgid "player" +msgstr "joueur" + +#: lg/models.py:51 +msgid "players" +msgstr "joueurs" + +#: lg/models.py:59 +msgid "werewolf" +msgstr "loup-garou" + +#: lg/models.py:60 +msgid "werewolves" +msgstr "loups-garous" + +#: lg/models.py:68 +msgid "cupidon" +msgstr "cupidon" + +#: lg/models.py:69 +msgid "cupidons" +msgstr "cupidons" + +#: lg/models.py:77 +msgid "witch" +msgstr "sorcière" + +#: lg/models.py:78 +msgid "witches" +msgstr "sorcières" + +#: lg/models.py:86 +msgid "raven" +msgstr "corbeau" + +#: lg/models.py:87 +msgid "ravens" +msgstr "corbeaux" + +#: lg/models.py:95 +msgid "dove" +msgstr "colombe" + +#: lg/models.py:96 +msgid "doves" +msgstr "colombes" + +#: lg/models.py:104 +msgid "hacker" +msgstr "hacker" + +#: lg/models.py:105 +msgid "hackers" +msgstr "hackers" + +#: lg/models.py:117 +msgid "night" +msgstr "nuit" + +#: lg/models.py:124 +msgid "action" +msgstr "action" + +#: lg/models.py:125 +msgid "actions" +msgstr "actions" + +#: lg/models.py:133 lg/models.py:146 lg/models.py:153 lg/models.py:190 +#: lg/models.py:207 lg/models.py:224 lg/models.py:231 lg/models.py:261 +msgid "target" +msgstr "cible" + +#: lg/models.py:137 +msgid "werewolf action" +msgstr "action de loup-garou" + +#: lg/models.py:138 +msgid "werewolf actions" +msgstr "actions de loup-garou" + +#: lg/models.py:170 +msgid "saved" +msgstr "sauvé" + +#: lg/models.py:177 +msgid "killed" +msgstr "tué" + +#: lg/models.py:181 +msgid "witch action" +msgstr "action de sorcière" + +#: lg/models.py:182 +msgid "witch actions" +msgstr "actions de sorcière" + +#: lg/models.py:194 lg/models.py:211 +msgid "message" +msgstr "message" + +#: lg/models.py:198 +msgid "raven action" +msgstr "action de corbeau" + +#: lg/models.py:199 +msgid "raven actions" +msgstr "actions de corbeau" + +#: lg/models.py:215 +msgid "dove action" +msgstr "action de colombe" + +#: lg/models.py:216 +msgid "dove actions" +msgstr "actions de colombe" + +#: lg/models.py:241 +msgid "hacker action" +msgstr "action de hacker" + +#: lg/models.py:242 +msgid "hacker actions" +msgstr "actions de hacker" + +#: lg/models.py:247 +msgid "day" +msgstr "jour" + +#: lg/models.py:254 +msgid "voter" +msgstr "voteur" + +#: lg/models.py:274 +msgid "vote" +msgstr "vote" + +#: lg/models.py:275 +msgid "votes" +msgstr "votes" + +#: lg/models.py:280 +msgid "captain vote" +msgstr "vote de capitaine" + +#: lg/models.py:281 +msgid "captain votes" +msgstr "votes de capitaine" + +#: lg/models.py:309 +msgid "eject vote" +msgstr "vote d'éjection" + +#: lg/models.py:310 +msgid "eject votes" +msgstr "votes d'éjection" + +#: lglog/settings.py:112 +msgid "English" +msgstr "Anglais" + +#: lglog/settings.py:113 +msgid "French" +msgstr "Français" + +#: lglog/templates/base_modal.html:19 +msgid "Close" +msgstr "Fermer" + +#: lglog/templates/index.html:5 +msgid "Index" +msgstr "Accueil"