diff --git a/contributors.py b/contributors.py deleted file mode 100644 index 02a2015c..00000000 --- a/contributors.py +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env python3 - -contributeurs = ['Gabriel Detraz', 'chirac', 'Maël Kervella', 'LEVY-FALK Hugo', 'Dalahro', 'lhark', 'root', 'Hugo LEVY-FALK', 'Chirac', 'guimoz', 'Mael Kervella', 'klafyvel', 'matthieu', 'Yoann Pietri', 'Simon Brélivet', 'chibrac', 'David Sinquin', 'Pierre Cadart', 'moamoak', 'Éloi Alain', 'FERNET Laouen', 'Hugo Levy-Falk', 'Joanne Steiner', 'Matthieu Michelet', 'Yoann PIETRI', 'B', 'Daniel STAN', 'Eloi Alain', 'Guimoz', 'Hugo Hervieux', 'Laouen Fernet', 'Lemesle', 'MICHELET matthieu', 'Nymous', 'Thibault de BOUTRAY', 'Tipunchetrhum', 'Éloi ALAIN'] \ No newline at end of file diff --git a/re2o/contributors.py b/re2o/contributors.py new file mode 100644 index 00000000..00e97e41 --- /dev/null +++ b/re2o/contributors.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python3 + +CONTRIBUTORS = ['Gabriel "Chirac" Détraz', 'Maël "MoaMoaK" Kervella', 'Hugo "Klafyvel" Levy--Falk', 'Augustin "Dahlaro" Lemesle', 'Goulven "Lhark" Kermarec', 'Guillaume "Guimoz" Goessel', 'Yoann "Nanoy" Pietri', 'Matthieu "Lebanni" Michelet', 'Arthur "Grizzly" Grisel-Davy', 'Simon "Rezatoune" Brélivet', 'Sellem Lev-Arcady', 'David "5-1" Sinquin', 'Pierre "Redstorm" Cadart', 'Éloi "Goslig" Alain', 'Laouen "Volgarr" Fernet', 'Joanne Steiner', '"Krokmou"', 'Thibault "Tipunchetrhum" de Boutray', 'Baptiste "B" Fournier', 'Daniel "Dstan" Stan', 'Hugo "Shaka" Hervieux', '"Mikachu"', 'Thomas "Nymous" Gaudin', '"Esum"'] diff --git a/re2o/locale/fr/LC_MESSAGES/django.mo b/re2o/locale/fr/LC_MESSAGES/django.mo new file mode 100644 index 00000000..eb533f3e Binary files /dev/null and b/re2o/locale/fr/LC_MESSAGES/django.mo differ diff --git a/re2o/locale/fr/LC_MESSAGES/django.po b/re2o/locale/fr/LC_MESSAGES/django.po new file mode 100644 index 00000000..2cabc6ec --- /dev/null +++ b/re2o/locale/fr/LC_MESSAGES/django.po @@ -0,0 +1,156 @@ +# Re2o est un logiciel d'administration développé initiallement au rezometz. Il +# se veut agnostique au réseau considéré, de manière à être installable en +# quelques clics. +# +# Copyright © 2018 Maël Kervella +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +msgid "" +msgstr "" +"Project-Id-Version: 2.5\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-03-31 14:05+0000\n" +"PO-Revision-Date: 2018-03-31 16:09+0002\n" +"Last-Translator: Maël Kervella \n" +"Language-Team: \n" +"Language: fr_FR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: templates/re2o/about.html:29 templates/re2o/about.html:35 +msgid "About Re2o" +msgstr "A propos de Re2o" + +#: templates/re2o/about.html:32 +#, python-format +msgid "About %(AssoName)s" +msgstr "A propos de %(AssoName)s" + +#: templates/re2o/about.html:36 +msgid "" +"\n" +" Re2o is an administration tool initiated by\n" +" Rezo Supelec Metz and a few\n" +" members of other FedeRez " +"associations\n" +" around the summer 2016.
\n" +" It is intended to be a tool independant from any network " +"infrastructure\n" +" so it can be setup in \"a few steps\". This tool is entirely free " +"and\n" +" available under a GNU Public License v2 (GPLv2) license on\n" +" FedeRez gitlab.
\n" +" Re2o's mainteners are proud volunteers mainly from French " +"engineering\n" +" schools (but not limited to) who have given a lot of their time to " +"make\n" +" this project possible. So please be kind with them.
\n" +" If you want to get involved in the development process, we will be " +"glad to\n" +" welcome you so do not hesitate to contact us and come help us build " +"the\n" +" future of Re2o.\n" +" " +msgstr "" +"\n" +" Re2o est un outil d'administration initié par\n" +"
Rezo Supelec Metz et quelques\n" +" membres d'autres assocations de " +"FedeRez\n" +" autour de l'été 2016.
\n" +" Il se veut être un outil idépendant de toute infrastructure réseau\n" +" pour pouvoir être installé en \"quelques étapes\". Cet outil est " +"entièrement gratuit et\n" +" est disponible sous license GNU Public License v2 (GPLv2) sur le\n" +" gitlab de FedeRez" +".
\n" +" Les mainteneurs de Re2o sont de fiers bénévoles venant principalement " +"d'écoles d'ingénieurs françaises\n" +" (mais pas seulement) qui ont donné beaucoup de leur temps pour faire " +"en sorte que\n" +" ce projet soit possible. Donc s'il vous plait soyez gentils avez eux." +"
\n" +" Si vous voulez prendre part au développement, nous serons heureux " +"de\n" +" vous accueillir donc n'hésitez pas à nous contacter et à venir nous " +"aider à construire le\n" +" futur de Re2o.\n" +" " + +#: templates/re2o/about.html:57 +msgid "Contributors list" +msgstr "Liste des contributeurs" + +#: templates/re2o/about.html:66 +msgid "Version informations" +msgstr "Informations de versions" + +#: templates/re2o/about.html:68 +#, python-format +msgid "" +"\n" +" Remote URL: %(git_info_remote)s\n" +" " +msgstr "" +"\n" +" URL distante : %(git_info_remote)s\n" +" " + +#: templates/re2o/about.html:71 +#, python-format +msgid "" +"\n" +" Branch: %(git_info_branch)s\n" +" " +msgstr "" +"\n" +" Branche : %(git_info_branch)s\n" +" " + +#: templates/re2o/about.html:74 +#, python-format +msgid "" +"\n" +" Commit: %(git_info_commit)s\n" +" " +msgstr "" +"\n" +" Commit : %(git_info_commit)s\n" +" " + +#: templates/re2o/about.html:77 +#, python-format +msgid "" +"\n" +" Commit date: %(git_info_commit_date)s\n" +" " +msgstr "" +"\n" +" Date du commit : %(git_info_commit_date)s\n" +" " + +#: templates/re2o/about.html:82 +msgid "Dependencies" +msgstr "Dépendances" + +#: views.py:172 +msgid "No Git repository configured" +msgstr "Aucun repository git configuré" + +#: views.py:178 +msgid "Unable to get the information" +msgstr "Impossible d'obtenir l'information" diff --git a/re2o/management/commands/gen_contrib.py b/re2o/management/commands/gen_contrib.py index d33b560d..08e57304 100644 --- a/re2o/management/commands/gen_contrib.py +++ b/re2o/management/commands/gen_contrib.py @@ -33,7 +33,7 @@ class Command(BaseCommand): def handle(self, *args, **options): contributeurs = [item.split('\t')[1] for item in os.popen("git shortlog -s -n").read().split("\n") if '\t' in item] self.stdout.write(self.style.SUCCESS("Exportation Sucessfull")) - contrib_file = open("contributors.py", "w") - contrib_file.write("#!/usr/bin/env python3\n") - contrib_file.write("\n") - contrib_file.write("contributeurs = " + str(contributeurs)) + with open("re2o/contributors.py", "w") as contrib_file: + contrib_file.write("#!/usr/bin/env python3\n") + contrib_file.write("\n") + contrib_file.write("CONTRIBUTORS = " + str(contributeurs)) diff --git a/re2o/settings.py b/re2o/settings.py index e7853141..dce3ef8f 100644 --- a/re2o/settings.py +++ b/re2o/settings.py @@ -123,6 +123,12 @@ WSGI_APPLICATION = 're2o.wsgi.application' LANGUAGE_CODE = 'en' +# Proritary location search for translations +# then searches in {app}/locale/ for app in INSTALLED_APPS +LOCALE_PATHS = [ + BASE_DIR + '/templates/locale/' # to define translations outside of apps +] + TIME_ZONE = 'Europe/Paris' USE_I18N = True diff --git a/re2o/templates/re2o/about.html b/re2o/templates/re2o/about.html index daec6d91..ac101031 100644 --- a/re2o/templates/re2o/about.html +++ b/re2o/templates/re2o/about.html @@ -24,39 +24,69 @@ with this program; if not, write to the Free Software Foundation, Inc., {% endcomment %} {% load bootstrap3 %} +{% load i18n %} -{% block title %}Historique{% endblock %} +{% block title %}{% trans "About Re2o" %}{% endblock %} {% block content %} -

À propos de {{AssoName}}

+

{% blocktrans %}About {{AssoName}}{% endblocktrans %}

{{ description }} -

À propos de Re2o

-

Re2o est un logiciel d'administration développé initialement au RézoMetz. Il -se veut indépendant de l'architecture du réseau considéré, de manière à être installable en -quelques clics. -C'est un logiciel totallement libre disponible sur le gitlab de FedeRez. -

-

Liste des contributeurs

-
-
- -
    - {% for i in contrib_1 %} -
  • {{i}}
  • - {% endfor %} -
-
-
-
    - {% for i in contrib_2 %} -
  • {{i}}
  • - {%endfor%} -
-
-
-
-
-
+

{% trans "About Re2o" %}

+

{% blocktrans %} + Re2o is an administration tool initiated by + Rezo Supelec Metz and a few + members of other FedeRez associations + around the summer 2016.
+ It is intended to be a tool independant from any network infrastructure + so it can be setup in "a few steps". This tool is entirely free and + available under a GNU Public License v2 (GPLv2) license on + FedeRez gitlab.
+ Re2o's mainteners are proud volunteers mainly from French engineering + schools (but not limited to) who have given a lot of their time to make + this project possible. So please be kind with them.
+ If you want to get involved in the development process, we will be glad to + welcome you so do not hesitate to contact us and come help us build the + future of Re2o. + {% endblocktrans %} +

+ +
+ +
+

{% trans "Contributors list" %}

+
    + {% for contributor in git_info_contributors %} +
  • {{ contributor }}
  • + {% endfor %} +
+
+ +
+

{% trans "Version informations" %}

+
    +
  • {% blocktrans %} + Remote URL: {{ git_info_remote }} + {% endblocktrans %}
  • +
  • {% blocktrans %} + Branch: {{ git_info_branch }} + {% endblocktrans %}
  • +
  • {% blocktrans %} + Commit: {{ git_info_commit }} + {% endblocktrans %}
  • +
  • {% blocktrans %} + Commit date: {{ git_info_commit_date }} + {% endblocktrans %}
  • +
+ +

{% trans "Dependencies" %}

+
    + {% for dependency in dependencies %} +
  • {{ dependency }}
  • + {% endfor %} +
+
+ +
{% endblock %} diff --git a/re2o/views.py b/re2o/views.py index bd9b18cb..cc0fb04e 100644 --- a/re2o/views.py +++ b/re2o/views.py @@ -33,15 +33,18 @@ from django.template.context_processors import csrf from django.contrib.auth.decorators import login_required, permission_required from reversion.models import Version from django.contrib import messages -from preferences.models import Service -from preferences.models import OptionalUser, GeneralOption, AssoOption from django.conf import settings -from contributors import contributeurs +from django.utils.translation import ugettext as _ +import git import os import time from itertools import chain +from preferences.models import Service +from preferences.models import OptionalUser, GeneralOption, AssoOption import users, preferences, cotisations, topologie, machines from .utils import re2o_paginator +from .settings import BASE_DIR, INSTALLED_APPS, MIDDLEWARE_CLASSES +from .contributors import CONTRIBUTORS def form(ctx, template, request): """Form générique, raccourci importé par les fonctions views du site""" @@ -162,12 +165,57 @@ def history(request, application, object_name, object_id): def about_page(request): option = AssoOption.objects.get() - n = len(contributeurs) - contrib_1 = contributeurs[:n//2] - contrib_2 = contributeurs[n//2:] + git_info_contributors = CONTRIBUTORS + try: + git_repo = git.Repo(BASE_DIR) + except git.InvalidGitRepositoryError: + NO_GIT_MSG = _("No Git repository configured") + git_info_remote = NO_GIT_MSG + git_info_branch = NO_GIT_MSG + git_info_commit = NO_GIT_MSG + git_info_commit_date = NO_GIT_MSG + else: + UNABLE_GIT_MSG = _("Unable to get the information") + + try: + git_info_remote = ", ".join(git_repo.remote().urls) + except: + git_info_remote = UNABLE_GIT_MSG + + try: + git_info_branch = git_repo.active_branch.name + except: + git_info_branch = UNABLE_GIT_MSG + + try: + last_commit = git_repo.commit() + except: + git_info_commit = UNABLE_GIT_MSG + else: + try: + git_info_commit = last_commit.hexsha + except: + git_info_commit = UNABLE_GIT_MSG + + try: + git_info_commit_date = last_commit.committed_datetime + except: + git_info_commit_date = UNABLE_GIT_MSG + + dependencies = INSTALLED_APPS + MIDDLEWARE_CLASSES + return render( request, "re2o/about.html", - {'description': option.description , 'AssoName' : option.name , 'contrib_1' : contrib_1 , 'contrib_2' : contrib_2} + { + 'description': option.description , + 'AssoName' : option.name , + 'git_info_contributors': git_info_contributors, + 'git_info_remote': git_info_remote, + 'git_info_branch': git_info_branch, + 'git_info_commit': git_info_commit, + 'git_info_commit_date': git_info_commit_date, + 'dependencies': dependencies + } ) diff --git a/templates/base.html b/templates/base.html index 6961e583..297cac89 100644 --- a/templates/base.html +++ b/templates/base.html @@ -27,6 +27,8 @@ with this program; if not, write to the Free Software Foundation, Inc., {% load bootstrap3 %} {% load acl %} {% load self_adhesion %} +{% load i18n %} + {% self_adhesion as var_sa %} @@ -39,17 +41,15 @@ with this program; if not, write to the Free Software Foundation, Inc., {# Load CSS and JavaScript #} {% bootstrap_css %} - - - {% comment %}{% endcomment %} + + {% bootstrap_javascript %} - - - - - - {% comment %}{% endcomment %} + + + + + {{ site_name }} : {% block title %}Accueil{% endblock %} @@ -86,7 +86,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
  • Gérer les adhérents
  • Gérer les clubs
  • {% acl_end %} - {% can_view_app machines %} + {% can_view_app machines %}
  • Gérer les machines
  • {% acl_end %} {% can_view_app cotisations %} @@ -99,17 +99,57 @@ with this program; if not, write to the Free Software Foundation, Inc., +
  • Switchs
  • +
  • Bornes WiFi
  • +
  • Chambres et locaux
  • + + {% acl_end %} {% can_view_app logs %}
  • Statistiques
  • {% acl_end %} - @@ -239,7 +278,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {# Read the documentation for more information #} diff --git a/templates/locale/fr/LC_MESSAGES/django.mo b/templates/locale/fr/LC_MESSAGES/django.mo new file mode 100644 index 00000000..7a3646b8 Binary files /dev/null and b/templates/locale/fr/LC_MESSAGES/django.mo differ diff --git a/templates/locale/fr/LC_MESSAGES/django.po b/templates/locale/fr/LC_MESSAGES/django.po new file mode 100644 index 00000000..9de43dbb --- /dev/null +++ b/templates/locale/fr/LC_MESSAGES/django.po @@ -0,0 +1,35 @@ +# Re2o est un logiciel d'administration développé initiallement au rezometz. Il +# se veut agnostique au réseau considéré, de manière à être installable en +# quelques clics. +# +# Copyright © 2018 Maël Kervella +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +msgid "" +msgstr "" +"Project-Id-Version: 2.5\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-03-31 14:05+0000\n" +"PO-Revision-Date: 2018-03-31 16:09+0002\n" +"Last-Translator: Maël Kervella \n" +"Language-Team: \n" +"Language: fr_FR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: base.html:121 +msgid "About" +msgstr "A propos"