gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-merchant-demos] branch master updated: i18n for survey


From: gnunet
Subject: [taler-taler-merchant-demos] branch master updated: i18n for survey
Date: Sun, 11 Oct 2020 15:05:28 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository taler-merchant-demos.

The following commit(s) were added to refs/heads/master by this push:
     new a984947  i18n for survey
a984947 is described below

commit a984947846c7b83d3151fc4987ca615edcb168ef
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Oct 11 15:05:16 2020 +0200

    i18n for survey
---
 .gitignore                                         |   1 +
 Makefile                                           |  16 +-
 babel.cfg                                          |   2 +-
 bin/taler-merchant-demos                           |  21 ++-
 setup.py                                           |   6 +-
 talermerchantdemos/blog/blog.py                    |  17 +-
 talermerchantdemos/blog/templates/base.html.j2     |   9 +-
 .../blog/templates/confirm_refund.html.j2          |   2 +-
 talermerchantdemos/donations/translations          |   1 +
 talermerchantdemos/survey/survey.py                |  60 ++++--
 talermerchantdemos/survey/templates/base.html      |  59 ------
 .../{blog => survey}/templates/base.html.j2        |  18 +-
 talermerchantdemos/survey/templates/error.html     |  22 ---
 talermerchantdemos/survey/templates/error.html.j2  |  24 +++
 .../survey/templates/{index.html => index.html.j2} |  12 +-
 .../survey/templates/survey_stats.html             |  15 --
 talermerchantdemos/survey/translations             |   1 +
 translations/de/LC_MESSAGES/messages.po            | 210 +++++++++++----------
 translations/messages.pot                          | 122 +-----------
 19 files changed, 256 insertions(+), 362 deletions(-)

diff --git a/.gitignore b/.gitignore
index 79ece56..65d5b00 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 talermerchantdemos/static/*.css
 talermerchantdemos/static/navbar.css.map
 translations/de/LC_MESSAGES/messages.mo
+config.mk
diff --git a/Makefile b/Makefile
index ad285a9..47e0399 100644
--- a/Makefile
+++ b/Makefile
@@ -8,17 +8,17 @@ all:
 .PHONY: install
 
 ifeq ($(install_global), true)
-install: install-global compile sass-build
+install: install-global
 else
-install: install-local compile sass-build
+install: install-local
 endif
 
 .PHONY: install-global
-install-global:
+install-global: compile sass-build
        pip3 install .
 
 .PHONY: install-local
-install-local:
+install-local: compile sass-build
        pip3 install . --user
 
 # run testcases
@@ -48,32 +48,40 @@ extract:
 #      Add new language as follows:
 #      pybabel init -i locale/messages.pot -d locale/ -l de
 
+.PHONY: compile
 compile: update
        pybabel compile -d translations/
 
+.PHONY: update
 update: extract
        pybabel update -i translations/messages.pot -d translations/
 
 # SASS/SCSS
 
+.PHONY: sass-setup
 sass-setup:
        @echo "This is the initial sass-installation/setup script."
        @echo "This setup must run as root, on a machine that has NPM 
installed!"
        @echo "If your password is requested (for escalation), please enter it."
        sudo npm install -g sass
 
+.PHONY: scss-setup
 scss-setup: sass-setup
 
+.PHONY: sass-build
 sass-build:
        @echo "Warning: If Sass/Scss is not installed, please run \`make 
sass-setup\` first!"
        @echo "This script will only convert files inside /static"
        sass talermerchantdemos/static:talermerchantdemos/static
 
+.PHONY: scss-build
 scss-build: sass-build
 
+.PHONY: sass-autobuild
 sass-autobuild:
        @echo "Warning: If Sass/Scss is not installed, please run \`make 
sass-setup\` first!"
        @echo "This script will automatically build sass/scss files in the 
static directory!"
        sass --watch talermerchantdemos/static:talermerchantdemos/static
 
+.PHONY: scss-autobuild
 scss-autobuild: sass-autobuild
diff --git a/babel.cfg b/babel.cfg
index cbe8963..339b5df 100644
--- a/babel.cfg
+++ b/babel.cfg
@@ -1,2 +1,2 @@
-[jinja2: **/templates/**.j2]
+[jinja2: **/templates/**.j2 **/*.py]
 extensions=jinja2.ext.autoescape,jinja2.ext.with_
diff --git a/bin/taler-merchant-demos b/bin/taler-merchant-demos
index f2318bf..e4286a2 100755
--- a/bin/taler-merchant-demos
+++ b/bin/taler-merchant-demos
@@ -73,11 +73,10 @@ def handle_serve_uwsgi(config, whichShop):
 # @param args command line options.
 def handle_serve_http(config, whichShop, port=None):
     if port is None:
-        try:
-            port = config[whichShop]["http_port"].value_int(required=True)
-        except ConfigurationError as ce:
-            print(ce)
-            exit(1)
+        port = config[whichShop]["http_port"].value_int(required=True)
+    if port is None:
+        print("'http_port' configuration option is missing")
+        exit(1)
     spec = ":%d" % (port,)
     try:
         os.execlp("uwsgi", "uwsgi",
@@ -91,10 +90,14 @@ def handle_serve_http(config, whichShop, port=None):
         sys.exit(1)
 
 def handle_serve_from_config(config_obj, which_shop):
-    if config_obj.value_string("blog", "serve", required=True).lower() == 
"http":
-        http_port = config_obj.value_int(which_shop, "port")        
-        return handle_serve_http(config_obj, which_shop, http_port)
-    handle_serve_uwsgi(config_obj, which_shop)
+    try:
+        if config_obj.value_string(which_shop, "serve", required=True).lower() 
== "http":
+            http_port = config_obj.value_int(which_shop, "port")
+            return handle_serve_http(config_obj, which_shop, http_port)
+        handle_serve_uwsgi(config_obj, which_shop)
+    except ConfigurationError as ce:
+        print(ce)
+        exit(1)
 
 @click.command("Global shop launcher")
 @click.option("--config", help="Configuration file", required=False)
diff --git a/setup.py b/setup.py
index aff081e..ba647d9 100755
--- a/setup.py
+++ b/setup.py
@@ -21,14 +21,18 @@ setup(name='talermerchantdemos',
               # Blog files
               "blog/templates/*.html",
               "blog/templates/*.j2",
+              "blog/static/favicon.ico",
               "blog/articles/*/*",
+              "blog/translations/*/LC_MESSAGES/*.mo",
               "blog/data/*",
               # Donation files
               "donations/templates/*.html",
+              "donations/translations/*/LC_MESSAGES/*.mo",
               # Survey files
-              "survey/templates/*.html",
+              "survey/templates/*.j2",
               "survey/static/favicon.ico",
               "survey/static/*.js",
+              "survey/translations/*/LC_MESSAGES/*.mo",
           ]
       },
       scripts=['./bin/taler-merchant-demos'],
diff --git a/talermerchantdemos/blog/blog.py b/talermerchantdemos/blog/blog.py
index 7112b33..ba6571b 100644
--- a/talermerchantdemos/blog/blog.py
+++ b/talermerchantdemos/blog/blog.py
@@ -61,6 +61,7 @@ BASE_DIR = os.path.dirname(os.path.abspath(__file__))
 app = flask.Flask(
     __name__, template_folder=BASE_DIR, static_folder=BASE_DIR + "/../static/"
 )
+app.debug = True
 app.secret_key = base64.b64encode(os.urandom(64)).decode("utf-8")
 
 LOGGER = logging.getLogger(__name__)
@@ -81,7 +82,8 @@ babel = Babel(app)
 print("Using translations from:")
 print(list(babel.translation_directories))
 translations = [str(translation) for translation in babel.list_translations()]
-translations.append('en')
+if not 'en' in translations:
+    translations.append('en')
 print("Operating with the following translations available:")
 print(translations)
 
@@ -126,6 +128,19 @@ def index():
     target = flask.request.accept_languages.best_match(translations, default)
     return flask.redirect("/" + target + "/", code=302)
 
+##
+# Serve the /favicon.ico requests.
+#
+# @return the favicon.ico file.
+@app.route("/favicon.ico")
+def favicon():
+    LOGGER.info("will look into: " + os.path.join(app.root_path, 'static'))
+    return flask.send_from_directory(
+        os.path.join(app.root_path, 'static'),
+        "favicon.ico",
+        mimetype="image/vnd.microsoft.ico"
+    )
+
 @babel.localeselector
 def get_locale():
     parts = request.path.split('/', 2)
diff --git a/talermerchantdemos/blog/templates/base.html.j2 
b/talermerchantdemos/blog/templates/base.html.j2
index 58ce857..1303276 100644
--- a/talermerchantdemos/blog/templates/base.html.j2
+++ b/talermerchantdemos/blog/templates/base.html.j2
@@ -69,8 +69,8 @@
 
 <body>
   <header class="demobar" style="display: flex; flex-direction: column;">
-    <h1><span class="tt adorn-brackets">Taler Demo</span></h1>
-    <h1><span class="it"><a href="{{ env('TALER_ENV_URL_MERCHANT_BLOG') 
}}">Shop</a></span></h1>
+    <h1><span class="tt adorn-brackets">{{ gettext("Taler Demo")}}</span></h1>
+    <h1><span class="it"><a href="{{ env('TALER_ENV_URL_MERCHANT_BLOG') }}">{{ 
gettext("Shop") }}</a></span></h1>
     <p>{{
       gettext("On this page you can buy articles using an imaginary 
currency.") + "<br>" +
       gettext("The articles are chapters from Richard Stallman's book 
&quot;Free Software, Free Society&quot;.") + "<br>" +
@@ -82,9 +82,9 @@
     <nav class="demolist">
       <a href="{{ env('TALER_ENV_URL_INTRO', '#') 
}}">{{gettext("Introduction")}}</a>
       <a href="{{ env('TALER_ENV_URL_BANK', '#') }}">{{gettext("Bank")}}</a>
-      <a href="{{ env('TALER_ENV_URL_MERCHANT_BLOG', '#') }}" 
class="active">{{gettext("Essay Shop")}}</a>
+      <a href="{{ env('TALER_ENV_URL_MERCHANT_BLOG', '#') }}">{{gettext("Essay 
Shop")}}</a>
       <a href="{{ env('TALER_ENV_URL_MERCHANT_DONATIONS', '#') 
}}">{{gettext("Donations")}}</a>
-      <a href="{{ env('TALER_ENV_URL_MERCHANT_SURVEY', '#') 
}}">{{gettext("Tipping/Survey")}}</a>
+      <a href="{{ env('TALER_ENV_URL_MERCHANT_SURVEY', '#') }}" 
class="active">{{gettext("Tipping/Survey")}}</a>
       <!-- a href="{{ env('TALER_ENV_URL_BACKOFFICE', '#') 
}}">{{gettext("Back-office")}}</a -->
       <span class="right">
         {{ gettext("English [en]") }}
@@ -102,7 +102,6 @@
       </span>
     </nav>
   </div>
-  <!-- <input type="checkbox" class="r"><label>test</label> -->
 
   <section id="main" class="content">
     {% block main %}
diff --git a/talermerchantdemos/blog/templates/confirm_refund.html.j2 
b/talermerchantdemos/blog/templates/confirm_refund.html.j2
index 09f3730..a371645 100644
--- a/talermerchantdemos/blog/templates/confirm_refund.html.j2
+++ b/talermerchantdemos/blog/templates/confirm_refund.html.j2
@@ -17,6 +17,6 @@
 
   <form action="{{ url_for('refund', order_id=order_id) }}" method="POST">
     <input type="text" name="article_name" value={{ article_name}} hidden>
-    <input type="submit" value="Request refund">
+    <input type="submit" value="{{gettext("Request refund")}}">
   </form>
 {% endblock main %}
diff --git a/talermerchantdemos/donations/translations 
b/talermerchantdemos/donations/translations
new file mode 120000
index 0000000..0a951f7
--- /dev/null
+++ b/talermerchantdemos/donations/translations
@@ -0,0 +1 @@
+../../translations/
\ No newline at end of file
diff --git a/talermerchantdemos/survey/survey.py 
b/talermerchantdemos/survey/survey.py
index b6a5ceb..140088d 100644
--- a/talermerchantdemos/survey/survey.py
+++ b/talermerchantdemos/survey/survey.py
@@ -1,6 +1,6 @@
 ##
 # This file is part of GNU TALER.
-# Copyright (C) 2017 Taler Systems SA
+# Copyright (C) 2017, 2020 Taler Systems SA
 #
 # 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
@@ -23,9 +23,14 @@ import base64
 import logging
 from urllib.parse import urljoin
 import flask
+from flask import request
+from flask_babel import Babel
+from flask_babel import refresh
+from flask_babel import force_locale
+from flask_babel import gettext
 import traceback
 from taler.util.talerconfig import TalerConfig, ConfigurationError
-from ..httpcommon import backend_get, backend_post, fallback_404
+from ..httpcommon import backend_get, backend_post, self_localized
 import sys
 
 if not sys.version_info.major == 3 and sys.version_info.minor >= 6:
@@ -37,6 +42,8 @@ BASE_DIR = os.path.dirname(os.path.abspath(__file__))
 app = flask.Flask(__name__, template_folder=BASE_DIR)
 app.debug = True
 app.secret_key = base64.b64encode(os.urandom(64)).decode('utf-8')
+
+LOGGER = logging.getLogger(__name__)
 TC = TalerConfig.from_env()
 try:
     BACKEND_URL = TC["frontends"]["backend"].value_string(required=True)
@@ -47,9 +54,30 @@ except ConfigurationError as ce:
     exit(1)
 
 app.config.from_object(__name__)
-LOGGER = logging.getLogger(__name__)
+babel = Babel(app)
 INSTANCED_URL = urljoin(BACKEND_URL, f"instances/survey/")
 
+print("Using translations from:")
+print(list(babel.translation_directories))
+translations = [str(translation) for translation in babel.list_translations()]
+if not 'en' in translations:
+    translations.append('en')
+print("Operating with the following translations available:")
+print(translations)
+
+app.jinja_env.globals.update(self_localized=self_localized)
+
+@babel.localeselector
+def get_locale():
+    parts = request.path.split('/', 2)
+    if (2 >= len(parts)):
+        # Totally unexpected path format, do not localize
+        return "en"
+    lang = parts[1]
+    if lang in translations:
+        return lang
+    return "en"
+
 ##
 # Make the environment available into templates.
 #
@@ -80,8 +108,8 @@ def utility_processor():
 @app.errorhandler(Exception)
 def internal_error(e):
     return flask.render_template(
-        "templates/error.html",
-        message="Internal error",
+        "templates/error.html.j2",
+        message=gettext("Internal error"),
         stack=traceback.format_exc()
     )
 
@@ -92,7 +120,7 @@ def internal_error(e):
 # @return the favicon.ico file.
 @app.route("/favicon.ico")
 def favicon():
-    print("will look into: " + os.path.join(app.root_path, 'static'))
+    LOGGER.info("will look into: " + os.path.join(app.root_path, 'static'))
     return flask.send_from_directory(
         os.path.join(app.root_path, 'static'),
         "favicon.ico",
@@ -105,7 +133,7 @@ def favicon():
 # @param abort_status_code status code to return along the response.
 # @param params _kw_ arguments to passed verbatim to the templating engine.
 def err_abort(abort_status_code, **params):
-    t = flask.render_template("templates/error.html", **params)
+    t = flask.render_template("templates/error.html.j2", **params)
     flask.abort(flask.make_response(t, abort_status_code))
 
 ##
@@ -127,16 +155,26 @@ def submit_survey():
     return flask.redirect(backend_resp["tip_status_url"])
 
 ##
-# Serve the main index page.
+# Serve the main index page, redirecting to /<lang>/
 #
 # @return response object of the index page.
-@app.route("/", methods=["GET"])
+@app.route("/")
 def index():
+    default = 'en'
+    target = flask.request.accept_languages.best_match(translations, default)
+    return flask.redirect("/" + target + "/", code=302)
+
+##
+# Serve the internationalized main index page.
+#
+# @return response object of the index page.
+@app.route("/<lang>/", methods=["GET"])
+def start(lang):
     return flask.render_template(
-        "templates/index.html", merchant_currency=CURRENCY
+        "templates/index.html.j2", merchant_currency=CURRENCY, lang=lang
     )
 
 @app.errorhandler(404)
 def handler(e):
     return flask.render_template(
-        "templates/error.html", message="Page not found")
+        "templates/error.html.j2", message=gettext("Page not found"))
diff --git a/talermerchantdemos/survey/templates/base.html 
b/talermerchantdemos/survey/templates/base.html
deleted file mode 100644
index 2eeace1..0000000
--- a/talermerchantdemos/survey/templates/base.html
+++ /dev/null
@@ -1,59 +0,0 @@
-<!DOCTYPE html>
-<!-- 
-  This file is part of GNU TALER.
-  Copyright (C) 2014, 2015, 2016 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 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
-  TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
--->
-
-<html data-taler-nojs="true">
-<head>
-  <title>Taler Survey Demo</title>
-  <link rel="stylesheet" type="text/css" href="{{ url_for('static', 
filename='pure.css') }}" />
-  <link rel="stylesheet" type="text/css" href="{{ url_for('static', 
filename='demo.css') }}" />
-  <link rel="stylesheet"
-        type="text/css"
-        href="{{ url_for('static', filename='web-common/taler-fallback.css') 
}}"
-        id="taler-presence-stylesheet"/>
-  {% block styles %}{% endblock %}
-  {% block scripts %}{% endblock %}
-</head>
-
-<body>
-  <div class="demobar">
-    <h1><span class="tt adorn-brackets">Taler Demo</span></h1>
-    <h1><span class="it"><a href="{{ env('TALER_ENV_URL_MERCHANT_SURVEY') 
}}">Survey</a></span></h1>
-    <p>This is the survey page, which demonatrates how merchants can reward 
their users by paying directly into their wallet.</p>
-    <ul>
-      <li><a href="{{ env('TALER_ENV_URL_INTRO', '#') }}">Introduction</a></li>
-      <li><a href="{{ env('TALER_ENV_URL_BANK', '#') }}">Bank</a></li>
-      <li><a href="{{ env('TALER_ENV_URL_MERCHANT_BLOG', '#') }}">Essay 
Shop</a></li>
-      <li><a href="{{ env('TALER_ENV_URL_MERCHANT_DONATIONS', '#') 
}}">Donations</a></li>
-      <li><a href="{{ env('TALER_ENV_URL_MERCHANT_SURVEY', '#') 
}}">Survey</a></li>
-      <li><a href="{{ env('TALER_ENV_URL_BACKOFFICE', '#') 
}}">Back-office</a></li>
-    </ul>
-    <p>You can learn more about Taler on our main <a 
href="https://taler.net";>website</a>.</p>
-  </div>
-
-  <section id="main" class="content">
-    <h1>Taler Survey Demo</h1>
-    {% block main %}
-      This is the main content of the page.
-    {% endblock %}
-    <hr />
-    <div class="copyright">
-      <p>Copyright &copy; 2014&mdash;2017 INRIA</p>
-      <a href="/javascript" data-jslicense="1" 
class="jslicenseinfo">JavaScript license information</a>
-    </div>
-  </section>
-</body>
-</html>
diff --git a/talermerchantdemos/blog/templates/base.html.j2 
b/talermerchantdemos/survey/templates/base.html.j2
similarity index 82%
copy from talermerchantdemos/blog/templates/base.html.j2
copy to talermerchantdemos/survey/templates/base.html.j2
index 58ce857..b6d1c62 100644
--- a/talermerchantdemos/blog/templates/base.html.j2
+++ b/talermerchantdemos/survey/templates/base.html.j2
@@ -15,12 +15,9 @@
   TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
 -->
 
-<html>
+<html data-taler-nojs="true">
 <head>
-  <meta charset="UTF-8">
-  <meta name="viewport" content="width=device-width, initial-scale=1.0">
-  {% block meta %}{% endblock %}
-  <title>{{ gettext("Taler Essay Shop Demo") }}</title>
+  <title>{{ gettext("Taler Survey Demo") }}</title>
   <link rel="stylesheet" type="text/css" href="{{ url_for('static', 
filename='pure.css') }}" />
   <link rel="stylesheet" type="text/css" href="{{ url_for('static', 
filename='demo.css') }}" />
   <link rel="stylesheet" type="text/css" href="{{ url_for('static', 
filename='navbar.css') }}" />
@@ -69,12 +66,12 @@
 
 <body>
   <header class="demobar" style="display: flex; flex-direction: column;">
-    <h1><span class="tt adorn-brackets">Taler Demo</span></h1>
-    <h1><span class="it"><a href="{{ env('TALER_ENV_URL_MERCHANT_BLOG') 
}}">Shop</a></span></h1>
+    <h1><span class="tt adorn-brackets">{{ gettext("Taler Demo") }}</span></h1>
+    <h1><span class="it"><a href="{{ env('TALER_ENV_URL_MERCHANT_SURVEY') 
}}">{{ gettext("Survey") }}</a></span></h1>
     <p>{{
-      gettext("On this page you can buy articles using an imaginary 
currency.") + "<br>" +
-      gettext("The articles are chapters from Richard Stallman's book 
&quot;Free Software, Free Society&quot;.") + "<br>" +
-      gettext('The book is <a href="{shop}">published by the FSF</a> and 
available gratis at <a 
href="{gnu}">gnu.org</a>.').format(shop="https://shop.fsf.org/product/free-software-free-society-2";,
 gnu="https://www.gnu.org";)
+      gettext("This is the Taler survey demonstration.") + "<br>" +
+      gettext("It demonatrates how merchants can reward their users by 
granting tips.") + "<br>" +
+      gettext("Tipping is a way for offer cash rewards that go directly into a 
user's wallet.")
       }}
     </p>
   </header>
@@ -102,7 +99,6 @@
       </span>
     </nav>
   </div>
-  <!-- <input type="checkbox" class="r"><label>test</label> -->
 
   <section id="main" class="content">
     {% block main %}
diff --git a/talermerchantdemos/survey/templates/error.html 
b/talermerchantdemos/survey/templates/error.html
deleted file mode 100644
index 0d4bd02..0000000
--- a/talermerchantdemos/survey/templates/error.html
+++ /dev/null
@@ -1,22 +0,0 @@
-{% extends "templates/base.html" %}
-{% block main %}
-  <h1>An Error Occurred</h1>
-
-  <p>{{ message }}</p>
-
-  {% if status_code %}
-  <p>The backend returned status code {{ status_code }}.</p>
-  {% endif %}
-
-  {% if json %}
-  <p>Backend Response:</p>
-  <pre>{{ json }}</pre>
-  {% endif %}
-
-  {% if stack %}
-  <p>Stack trace:</p>
-  <pre>
-    {{ stack }}
-  </pre>
-  {% endif %}
-{% endblock main %}
diff --git a/talermerchantdemos/survey/templates/error.html.j2 
b/talermerchantdemos/survey/templates/error.html.j2
new file mode 100644
index 0000000..ffc2e1f
--- /dev/null
+++ b/talermerchantdemos/survey/templates/error.html.j2
@@ -0,0 +1,24 @@
+{% extends "templates/base.html.j2" %}
+{% block main %}
+  <h1>{{ gettext("Error encountered") }}</h1>
+
+  <p>{{ message }}</p>
+
+  {% if status_code %}
+  <p>
+    {{ gettext ("The backend returned status code 
{code}.").format(code=status_code) }}.
+  </p>
+  {% endif %}
+
+  {% if json %}
+  <p>{{gettext("Backend response:")}}</p>
+  <pre>{{ json }}</pre>
+  {% endif %}
+
+  {% if stack %}
+  <p>{{gettext("Stack trace:")}}</p>
+  <pre>
+    {{ stack }}
+  </pre>
+  {% endif %}
+{% endblock main %}
diff --git a/talermerchantdemos/survey/templates/index.html 
b/talermerchantdemos/survey/templates/index.html.j2
similarity index 59%
rename from talermerchantdemos/survey/templates/index.html
rename to talermerchantdemos/survey/templates/index.html.j2
index f40c235..9c9df5b 100644
--- a/talermerchantdemos/survey/templates/index.html
+++ b/talermerchantdemos/survey/templates/index.html.j2
@@ -1,15 +1,15 @@
-{% extends "templates/base.html" %}
-
+{% extends "templates/base.html.j2" %}
 {% block main %}
   <div>
     <p>
-      In this page, you can participate in our survey about payment systems
-      and get a nice tip - via your Taler wallet - from this shop!
+    {{
+    gettext("On this page, you can participate in our survey about payment 
systems and receive a tip in return.")
+    }}
     </p>
   </div>
   <div>
     <form action="{{ url_for('submit_survey') }}" method="post" 
class="pure-form pure-form-stacked">
-      <legend>What do you prefer?</legend>
+      <legend>{{ gettext("Which payment system do you prefer?") }}</legend>
       <fieldset>
       <label for="option-taler">
         <input id="option-taler" type="radio" name="paypref" value="taler" 
checked="checked" />
@@ -20,7 +20,7 @@
         Visa
       </label>
       </fieldset>
-      <input type="submit" value="Submit Survey" class="pure-button 
pure-button-primary" />
+      <input type="submit" value="{{ gettext("Submit Survey")}}" 
class="pure-button pure-button-primary" />
     </form>
   </div>
 {% endblock %}
diff --git a/talermerchantdemos/survey/templates/survey_stats.html 
b/talermerchantdemos/survey/templates/survey_stats.html
deleted file mode 100644
index 41cb437..0000000
--- a/talermerchantdemos/survey/templates/survey_stats.html
+++ /dev/null
@@ -1,15 +0,0 @@
-{% extends "templates/base.html" %}
-
-{% block main %}
-  <div>
-    <p>This page shows information about the tipping configuration of the
-    merchant.  Usually this should not be visible to users.</p>
-    <ul>
-    <li>Reserve pub: {{ stats['reserve_pub'] }}</li>
-    <li>Reserve expiration: {{ prettydate(stats['reserve_expiration']) }}</li>
-    <li>Amount available {{ stats['amount_available'] }}</li>
-    <li>Amount picked up {{ stats['amount_picked_up'] }}</li>
-    <li>Amount authorized {{ stats['amount_authorized'] }}</li>
-    <ul>
-  </div>
-{% endblock %}
diff --git a/talermerchantdemos/survey/translations 
b/talermerchantdemos/survey/translations
new file mode 120000
index 0000000..0a951f7
--- /dev/null
+++ b/talermerchantdemos/survey/translations
@@ -0,0 +1 @@
+../../translations/
\ No newline at end of file
diff --git a/translations/de/LC_MESSAGES/messages.po 
b/translations/de/LC_MESSAGES/messages.po
index e88de1e..b7a78fc 100644
--- a/translations/de/LC_MESSAGES/messages.po
+++ b/translations/de/LC_MESSAGES/messages.po
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PROJECT VERSION\n"
 "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
-"POT-Creation-Date: 2020-10-11 13:28+0200\n"
+"POT-Creation-Date: 2020-10-11 15:01+0200\n"
 "PO-Revision-Date: 2020-10-09 21:25+0200\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language: de\n"
@@ -18,123 +18,143 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "Generated-By: Babel 2.6.0\n"
 
-#: talermerchantdemos/blog/templates/article_frame.html.j2:9
-msgid "You did not like this article?"
-msgstr ""
+#~ msgid "You did not like this article?"
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/article_frame.html.j2:10
-msgid ""
-"You can <a href=\"{url}\">request a refund</a> within the first hour "
-"after buying it."
-msgstr ""
+#~ msgid ""
+#~ "You can <a href=\"{url}\">request a "
+#~ "refund</a> within the first hour after"
+#~ " buying it."
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/base.html.j2:23
-msgid "Taler Essay Shop Demo"
-msgstr ""
+#~ msgid "Taler Essay Shop Demo"
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/base.html.j2:75
-msgid "On this page you can buy articles using an imaginary currency."
-msgstr ""
+#~ msgid "Taler Demo"
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/base.html.j2:76
-msgid ""
-"The articles are chapters from Richard Stallman's book &quot;Free "
-"Software, Free Society&quot;."
-msgstr ""
+#~ msgid "Shop"
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/base.html.j2:77
-msgid ""
-"The book is <a href=\"{shop}\">published by the FSF</a> and available "
-"gratis at <a href=\"{gnu}\">gnu.org</a>."
-msgstr ""
+#~ msgid "On this page you can buy articles using an imaginary currency."
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/base.html.j2:83
-msgid "Introduction"
-msgstr ""
+#~ msgid ""
+#~ "The articles are chapters from Richard"
+#~ " Stallman's book &quot;Free Software, Free"
+#~ " Society&quot;."
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/base.html.j2:84
-msgid "Bank"
-msgstr ""
+#~ msgid ""
+#~ "The book is <a href=\"{shop}\">published "
+#~ "by the FSF</a> and available gratis "
+#~ "at <a href=\"{gnu}\">gnu.org</a>."
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/base.html.j2:85
-msgid "Essay Shop"
-msgstr ""
+#~ msgid "Introduction"
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/base.html.j2:86
-msgid "Donations"
-msgstr ""
+#~ msgid "Bank"
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/base.html.j2:87
-msgid "Tipping/Survey"
-msgstr ""
+#~ msgid "Essay Shop"
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/base.html.j2:88
-msgid "Back-office"
-msgstr ""
+#~ msgid "Donations"
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/base.html.j2:90
-msgid "English [en]"
-msgstr ""
+#~ msgid "Tipping/Survey"
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/base.html.j2:113
-msgid "You can learn more about Taler on our main <a 
href=\"{site}\">website</a>."
-msgstr ""
+#~ msgid "Back-office"
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/error.html.j2:3
-msgid "Error encountered"
-msgstr ""
+#~ msgid "English [en]"
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/error.html.j2:9
-msgid "The backend returned status code {code}."
-msgstr ""
+#~ msgid ""
+#~ "You can learn more about Taler on"
+#~ " our main <a href=\"{site}\">website</a>."
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/error.html.j2:14
-msgid "Backend response:"
-msgstr ""
+#~ msgid "Error encountered"
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/error.html.j2:19
-msgid "Stack trace:"
-msgstr ""
+#~ msgid "The backend returned status code {code}."
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/index.html.j2:3
-msgid "Essay Shop: Free Software, Free Society"
-msgstr "Essay Laden: Freie Software, Freie Gesellschaft"
+#~ msgid "Backend response:"
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/index.html.j2:5
-msgid ""
-"This is the latest edition of <cite>Free Software, Free Society: Selected"
-" Essays of Richard M. Stallman.</cite>"
-msgstr ""
+#~ msgid "Stack trace:"
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/index.html.j2:13
-msgid ""
-"Verbatim copying and distribution of this entire book are permitted "
-"worldwide, without royalty, in any medium, provided this notice is "
-"preserved. Permission is granted to copy and distribute translations of "
-"this book from the original English into another language provided the "
-"translation has been approved by the Free Software Foundation and the "
-"copyright notice and this permission notice are preserved on all copies."
-msgstr ""
+#~ msgid "Essay Shop: Free Software, Free Society"
+#~ msgstr "Essay Laden: Freie Software, Freie Gesellschaft"
 
-#: talermerchantdemos/blog/templates/index.html.j2:18
-msgid "Chapters"
-msgstr ""
+#~ msgid ""
+#~ "This is the latest edition of "
+#~ "<cite>Free Software, Free Society: Selected"
+#~ " Essays of Richard M. Stallman.</cite>"
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/index.html.j2:21
-msgid "Click on an individual chapter to to purchase it with GNU Taler."
-msgstr ""
+#~ msgid ""
+#~ "Verbatim copying and distribution of "
+#~ "this entire book are permitted "
+#~ "worldwide, without royalty, in any "
+#~ "medium, provided this notice is "
+#~ "preserved. Permission is granted to copy"
+#~ " and distribute translations of this "
+#~ "book from the original English into "
+#~ "another language provided the translation "
+#~ "has been approved by the Free "
+#~ "Software Foundation and the copyright "
+#~ "notice and this permission notice are"
+#~ " preserved on all copies."
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/index.html.j2:22
-msgid ""
-"You can get free, virtual money to buy articles on this page at the <a "
-"href=\"{}\")\">bank</a>"
-msgstr ""
+#~ msgid "Chapters"
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/index.html.j2:30
-msgid "Pay to read more..."
-msgstr ""
+#~ msgid "Click on an individual chapter to to purchase it with GNU Taler."
+#~ msgstr ""
 
-#: talermerchantdemos/blog/templates/index.html.j2:33
-msgid "No articles available in this language."
-msgstr ""
+#~ msgid ""
+#~ "You can get free, virtual money to"
+#~ " buy articles on this page at "
+#~ "the <a href=\"{}\")\">bank</a>"
+#~ msgstr ""
+
+#~ msgid "Pay to read more..."
+#~ msgstr ""
+
+#~ msgid "No articles available in this language."
+#~ msgstr ""
+
+#~ msgid "Taler Survey Demo"
+#~ msgstr ""
+
+#~ msgid "Survey"
+#~ msgstr ""
+
+#~ msgid "This is the Taler survey demonstration."
+#~ msgstr ""
+
+#~ msgid "It demonatrates how merchants can reward their users by granting 
tips."
+#~ msgstr ""
+
+#~ msgid ""
+#~ "Tipping is a way for offer cash"
+#~ " rewards that go directly into a "
+#~ "user's wallet."
+#~ msgstr ""
+
+#~ msgid ""
+#~ "On this page, you can participate "
+#~ "in our survey about payment systems "
+#~ "and receive a tip in return."
+#~ msgstr ""
+
+#~ msgid "Which payment system do you prefer?"
+#~ msgstr ""
 
diff --git a/translations/messages.pot b/translations/messages.pot
index 8a8b012..368a4bb 100644
--- a/translations/messages.pot
+++ b/translations/messages.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PROJECT VERSION\n"
 "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
-"POT-Creation-Date: 2020-10-11 13:28+0200\n"
+"POT-Creation-Date: 2020-10-11 15:01+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"
@@ -17,123 +17,3 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "Generated-By: Babel 2.6.0\n"
 
-#: talermerchantdemos/blog/templates/article_frame.html.j2:9
-msgid "You did not like this article?"
-msgstr ""
-
-#: talermerchantdemos/blog/templates/article_frame.html.j2:10
-msgid ""
-"You can <a href=\"{url}\">request a refund</a> within the first hour "
-"after buying it."
-msgstr ""
-
-#: talermerchantdemos/blog/templates/base.html.j2:23
-msgid "Taler Essay Shop Demo"
-msgstr ""
-
-#: talermerchantdemos/blog/templates/base.html.j2:75
-msgid "On this page you can buy articles using an imaginary currency."
-msgstr ""
-
-#: talermerchantdemos/blog/templates/base.html.j2:76
-msgid ""
-"The articles are chapters from Richard Stallman's book &quot;Free "
-"Software, Free Society&quot;."
-msgstr ""
-
-#: talermerchantdemos/blog/templates/base.html.j2:77
-msgid ""
-"The book is <a href=\"{shop}\">published by the FSF</a> and available "
-"gratis at <a href=\"{gnu}\">gnu.org</a>."
-msgstr ""
-
-#: talermerchantdemos/blog/templates/base.html.j2:83
-msgid "Introduction"
-msgstr ""
-
-#: talermerchantdemos/blog/templates/base.html.j2:84
-msgid "Bank"
-msgstr ""
-
-#: talermerchantdemos/blog/templates/base.html.j2:85
-msgid "Essay Shop"
-msgstr ""
-
-#: talermerchantdemos/blog/templates/base.html.j2:86
-msgid "Donations"
-msgstr ""
-
-#: talermerchantdemos/blog/templates/base.html.j2:87
-msgid "Tipping/Survey"
-msgstr ""
-
-#: talermerchantdemos/blog/templates/base.html.j2:88
-msgid "Back-office"
-msgstr ""
-
-#: talermerchantdemos/blog/templates/base.html.j2:90
-msgid "English [en]"
-msgstr ""
-
-#: talermerchantdemos/blog/templates/base.html.j2:113
-msgid "You can learn more about Taler on our main <a 
href=\"{site}\">website</a>."
-msgstr ""
-
-#: talermerchantdemos/blog/templates/error.html.j2:3
-msgid "Error encountered"
-msgstr ""
-
-#: talermerchantdemos/blog/templates/error.html.j2:9
-msgid "The backend returned status code {code}."
-msgstr ""
-
-#: talermerchantdemos/blog/templates/error.html.j2:14
-msgid "Backend response:"
-msgstr ""
-
-#: talermerchantdemos/blog/templates/error.html.j2:19
-msgid "Stack trace:"
-msgstr ""
-
-#: talermerchantdemos/blog/templates/index.html.j2:3
-msgid "Essay Shop: Free Software, Free Society"
-msgstr ""
-
-#: talermerchantdemos/blog/templates/index.html.j2:5
-msgid ""
-"This is the latest edition of <cite>Free Software, Free Society: Selected"
-" Essays of Richard M. Stallman.</cite>"
-msgstr ""
-
-#: talermerchantdemos/blog/templates/index.html.j2:13
-msgid ""
-"Verbatim copying and distribution of this entire book are permitted "
-"worldwide, without royalty, in any medium, provided this notice is "
-"preserved. Permission is granted to copy and distribute translations of "
-"this book from the original English into another language provided the "
-"translation has been approved by the Free Software Foundation and the "
-"copyright notice and this permission notice are preserved on all copies."
-msgstr ""
-
-#: talermerchantdemos/blog/templates/index.html.j2:18
-msgid "Chapters"
-msgstr ""
-
-#: talermerchantdemos/blog/templates/index.html.j2:21
-msgid "Click on an individual chapter to to purchase it with GNU Taler."
-msgstr ""
-
-#: talermerchantdemos/blog/templates/index.html.j2:22
-msgid ""
-"You can get free, virtual money to buy articles on this page at the <a "
-"href=\"{}\")\">bank</a>"
-msgstr ""
-
-#: talermerchantdemos/blog/templates/index.html.j2:30
-msgid "Pay to read more..."
-msgstr ""
-
-#: talermerchantdemos/blog/templates/index.html.j2:33
-msgid "No articles available in this language."
-msgstr ""
-

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]