summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-09-04 11:54:58 +0200
committerMarcello Stanisci <stanisci.m@gmail.com>2018-09-04 11:54:58 +0200
commitc86d414cbf792b62dc3b3aa477b81e77b0befda1 (patch)
treecc1a76c0899689b05bd6a0cab91d6a8db9e91a1d
parentcadefe013c1a3554a27efe349eedbae1876632bb (diff)
downloadbackoffice-c86d414cbf792b62dc3b3aa477b81e77b0befda1.tar.gz
backoffice-c86d414cbf792b62dc3b3aa477b81e77b0befda1.tar.bz2
backoffice-c86d414cbf792b62dc3b3aa477b81e77b0befda1.zip
Select the language based on the /<lang>/ URL component.
-rw-r--r--talerbackoffice/backoffice/backoffice.py33
-rw-r--r--talerbackoffice/backoffice/templates/translations/messages.pot30
2 files changed, 15 insertions, 48 deletions
diff --git a/talerbackoffice/backoffice/backoffice.py b/talerbackoffice/backoffice/backoffice.py
index 5f81602..8b6242b 100644
--- a/talerbackoffice/backoffice/backoffice.py
+++ b/talerbackoffice/backoffice/backoffice.py
@@ -1,16 +1,19 @@
# This file is part of GNU TALER.
# Copyright (C) 2014-2017 INRIA
#
-# TALER is free software; you can redistribute it and/or modify it under the
-# terms of the GNU Lesser General Public License as published by the Free Software
-# Foundation; either version 2.1, or (at your option) any later version.
+# TALER is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1,
+# or (at your option) any later version.
#
-# TALER 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 Lesser General Public License for more details.
+# TALER 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 Lesser General Public License for more details.
#
-# You should have received a copy of the GNU Lesser General Public License along with
-# GNU TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+# You should have received a copy of the GNU Lesser General Public
+# License along with GNU TALER; see the file COPYING. If not, see
+# <http://www.gnu.org/licenses/>
#
# @author Florian Dold
# @author Marcello Stanisci
@@ -60,16 +63,10 @@ LANGUAGES = {
@babel.localeselector
def get_locale():
-
- return "it"
-
- # BUG: qs is always empty.
- print("get_locale dead code")
- qs = get_query_string().decode("utf-8")
- for token in qs.split("/"):
- if "" == token:
- pass
- return token if token in LANGUAGES.keys() else "en"
+ # If any "lang" component exists in the path, then
+ # it must be at the second position into the split array.
+ lang = flask.request.path.split("/")[1]
+ return lang if lang in LANGUAGES.keys() else "en"
@app.context_processor
def utility_processor():
diff --git a/talerbackoffice/backoffice/templates/translations/messages.pot b/talerbackoffice/backoffice/templates/translations/messages.pot
deleted file mode 100644
index f17b733..0000000
--- a/talerbackoffice/backoffice/templates/translations/messages.pot
+++ /dev/null
@@ -1,30 +0,0 @@
-# Translations template for PROJECT.
-# Copyright (C) 2018 ORGANIZATION
-# This file is distributed under the same license as the PROJECT project.
-# FIRST AUTHOR <EMAIL@ADDRESS>, 2018.
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: PROJECT VERSION\n"
-"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
-"POT-Creation-Date: 2018-09-03 15:35+0200\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Generated-By: Babel 2.3.4\n"
-
-#: backoffice.html:4
-msgid ""
-"This is the Taler backoffice facility. Through it,\n"
-" the user can see the money flow from Taler transactions to\n"
-" wire transfers and viceversa."
-msgstr ""
-
-#: backoffice.html:14
-msgid "Current instance:"
-msgstr ""
-