From 6dc6ab1aafbd2df24474b0dfcbd75b98cddccbff Mon Sep 17 00:00:00 2001 From: CyrilM <mammar@lal.in2p3.fr> Date: Tue, 16 Oct 2018 12:59:44 +0200 Subject: [PATCH] =?UTF-8?q?Add=20templates=20labels=5Ftitle=20&=20result?= =?UTF-8?q?=5Ftitle:=20Depuis=20le=20fichier=20labelsTower.py=20il=20est?= =?UTF-8?q?=20maintenant=20possible=20de=20changer=20des=20variables=20du?= =?UTF-8?q?=20template=20browse.html=20comme=20le=20titre=20des=20labels?= =?UTF-8?q?=20et=20des=20r=C3=A9sultats=20en=20fonction=20des=20langues.?= =?UTF-8?q?=20Le=20tableau=20associaif=20des=20noms=20s'appele=20text=5Fco?= =?UTF-8?q?mponent.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/labelsTower.py | 7 ++++++- app/templates/browse.html | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/labelsTower.py b/app/labelsTower.py index 54ce638..b0d7a3b 100644 --- a/app/labelsTower.py +++ b/app/labelsTower.py @@ -18,6 +18,11 @@ class CustomFlask(Flask): app = CustomFlask(__name__) app.config['DEBUG'] = True +text_component = {"labels_title_fr": "Étiquettes", + "labels_title_ang": "Labels", + "result_title_fr": "Tutoriels", + "result_title_ang": "Tutorials"} + @app.route('/') def home(): return search_tuto() @@ -89,7 +94,7 @@ def manage_labels(): @app.route('/browse') def search_tuto(): - return render_template('browse.html') + return render_template('browse.html', txt=text_component) @app.route('/add_new_tuto', methods=['GET', 'POST']) def add_new_tuto(): diff --git a/app/templates/browse.html b/app/templates/browse.html index d50e14d..313f3f7 100644 --- a/app/templates/browse.html +++ b/app/templates/browse.html @@ -27,8 +27,8 @@ <div id='hierarchy' class="panel panel-primary" v-cloak> <div class="panel-heading title"> - <span v-if="this.labels_language == 'US'" style="margin-left: 9%; margin-right: 4%"><span class="glyphicon glyphicon-tags"></span>Labels</span> - <span v-else style="margin-left: -6%; margin-right: 4%;"><span class="glyphicon glyphicon-tags"></span>Étiquettes</span> + <span v-if="this.labels_language == 'US'" style="margin-left: 9%; margin-right: 4%"><span class="glyphicon glyphicon-tags"></span>[[ txt['labels_title_ang'] ]]</span> + <span v-else style="margin-left: -6%; margin-right: 4%;"><span class="glyphicon glyphicon-tags"></span>[[ txt['labels_title_fr'] ]]</span> <span style="margin-right: -10%;"> <span v-if='this.labels_language == "FR"'> <img style="height:25px; width:25px; margin-right: 3%;" src="static/boue_france.png"> @@ -82,8 +82,8 @@ <div class="panel-heading title"> <span style="margin-left: 9%; margin-right: 3%;"> <span class="glyphicon glyphicon-book"></span> - <span v-if="this.labels_language == 'FR'">Tutoriels</span> - <span v-else="this.labels_language == 'US'">Tutorials</span> + <span v-if="this.labels_language == 'FR'">[[ txt['result_title_fr'] ]]</span> + <span v-else="this.labels_language == 'US'">[[ txt['result_title_ang'] ]]</span> </span> <span style="margin-left: 0%"> -- GitLab