[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-backoffice] branch master updated: Rename 'locale' d
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-backoffice] branch master updated: Rename 'locale' directory to 'translations'. |
Date: |
Tue, 31 Jul 2018 14:16:56 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository backoffice.
The following commit(s) were added to refs/heads/master by this push:
new 9730959 Rename 'locale' directory to 'translations'.
9730959 is described below
commit 9730959cd562f10adcfaa8c66f82e9223080687d
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue Jul 31 14:16:18 2018 +0200
Rename 'locale' directory to 'translations'.
That's the default for Babel.
---
talerbackoffice/backoffice/backoffice.py | 26 +++++++++++++++
talerbackoffice/backoffice/templates/Makefile | 39 +++++++++++-----------
.../{backoffice.html.j2 => backoffice.html} | 0
.../templates/{base.html.j2 => base.html} | 0
.../{javascript.html.j2 => javascript.html} | 0
.../templates/{locale => translations}/babel.map | 9 ++---
.../de/LC_MESSAGES/messages.po | 0
.../en/LC_MESSAGES/messages.po | 0
.../es/LC_MESSAGES/messages.po | 0
.../fr/LC_MESSAGES/messages.po | 0
.../it/LC_MESSAGES/messages.po | 0
.../{locale => translations}/messages.pot | 0
.../pt/LC_MESSAGES/messages.po | 0
.../ru/LC_MESSAGES/messages.po | 0
14 files changed, 49 insertions(+), 25 deletions(-)
diff --git a/talerbackoffice/backoffice/backoffice.py
b/talerbackoffice/backoffice/backoffice.py
index ad65a88..ce2858e 100644
--- a/talerbackoffice/backoffice/backoffice.py
+++ b/talerbackoffice/backoffice/backoffice.py
@@ -26,6 +26,7 @@ import os
import base64
import requests
import flask
+from flask.ext.babel import Babel
from talerbackoffice.talerconfig import TalerConfig
from ..helpers import (join_urlparts, \
get_query_string, backend_error)
@@ -37,6 +38,7 @@ 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')
+babel = Babel(app)
TC = TalerConfig.from_env()
@@ -45,6 +47,29 @@ INSTANCES = os.environ.get("BACKOFFICE_INSTANCES")
CURRENCY = TC["taler"]["currency"].value_string(required=True)
app.config.from_object(__name__)
+LANGUAGES = {
+ 'de': 'German',
+ 'en': 'English',
+ 'it': 'Italian',
+ 'fr': 'French',
+ 'pt': 'Portuguese',
+ 'es': 'Spanish',
+ 'ru': 'Russian',
+}
+
address@hidden
+def get_locale():
+
+ # Locale extraction should be made from the URL.
+ return "en"
+
+ # To be activated once the i18n machinery is up.
+ qs = get_query_string().decode("utf-8")
+ for token in qs.split("/"):
+ if "" == token:
+ pass
+ return token if token in LANGUAGES.keys() else "en"
+
@app.context_processor
def utility_processor():
def url(my_url):
@@ -54,6 +79,7 @@ def utility_processor():
return dict(url=url, env=env)
address@hidden("/<lang>/")
@app.route("/")
def index():
return flask.render_template("templates/backoffice.html",
instances=INSTANCES.split())
diff --git a/talerbackoffice/backoffice/templates/Makefile
b/talerbackoffice/backoffice/templates/Makefile
index d3513b7..b25897d 100644
--- a/talerbackoffice/backoffice/templates/Makefile
+++ b/talerbackoffice/backoffice/templates/Makefile
@@ -2,39 +2,40 @@
# All: build HTML pages in all languages and compile the
# TypeScript logic in web-common.
-all: locale template
+all: locale
true
# Extract translateable strings from jinja2 templates.
-locale/messages.pot: *.j2 common/*.j2 common/*.j2.inc
- env PYTHONPATH="." pybabel extract -F locale/babel.map -o
locale/messages.pot .
+locale/messages.pot: *.html
+ env PYTHONPATH="." pybabel extract -F translations/babel.map -o
translations/messages.pot .
# Update translation (.po) files with new strings.
locale-update: locale/messages.pot
- msgmerge -U -m --previous locale/en/LC_MESSAGES/messages.po
locale/messages.pot
- msgmerge -U -m --previous locale/de/LC_MESSAGES/messages.po
locale/messages.pot
- msgmerge -U -m --previous locale/fr/LC_MESSAGES/messages.po
locale/messages.pot
- msgmerge -U -m --previous locale/es/LC_MESSAGES/messages.po
locale/messages.pot
- msgmerge -U -m --previous locale/it/LC_MESSAGES/messages.po
locale/messages.pot
- msgmerge -U -m --previous locale/ru/LC_MESSAGES/messages.po
locale/messages.pot
- msgmerge -U -m --previous locale/pt/LC_MESSAGES/messages.po
locale/messages.pot
+ msgmerge -U -m --previous translations/en/LC_MESSAGES/messages.po
translations/messages.pot
+ msgmerge -U -m --previous translations/de/LC_MESSAGES/messages.po
translations/messages.pot
+ msgmerge -U -m --previous translations/fr/LC_MESSAGES/messages.po
translations/messages.pot
+ msgmerge -U -m --previous translations/es/LC_MESSAGES/messages.po
translations/messages.pot
+ msgmerge -U -m --previous translations/it/LC_MESSAGES/messages.po
translations/messages.pot
+ msgmerge -U -m --previous translations/ru/LC_MESSAGES/messages.po
translations/messages.pot
+ msgmerge -U -m --previous translations/pt/LC_MESSAGES/messages.po
translations/messages.pot
- if grep -nA1 '#-#-#-#-#' locale/*/LC_MESSAGES/messages.po; then echo -e
"\nERROR: Conflicts encountered in PO files.\n"; exit 1; fi
+ if grep -nA1 '#-#-#-#-#' translations/*/LC_MESSAGES/messages.po; then
echo -e "\nERROR: Conflicts encountered in PO files.\n"; exit 1; fi
# Compile translation files for use.
locale-compile:
- pybabel compile -d locale -l en --use-fuzzy
- pybabel compile -d locale -l de --use-fuzzy
- pybabel compile -d locale -l fr --use-fuzzy
- pybabel compile -d locale -l it --use-fuzzy
- pybabel compile -d locale -l es --use-fuzzy
- pybabel compile -d locale -l ru --use-fuzzy
- pybabel compile -d locale -l pt --use-fuzzy
+ pybabel compile -d translations -l en --use-fuzzy
+ pybabel compile -d translations -l de --use-fuzzy
+ pybabel compile -d translations -l fr --use-fuzzy
+ pybabel compile -d translations -l it --use-fuzzy
+ pybabel compile -d translations -l es --use-fuzzy
+ pybabel compile -d translations -l ru --use-fuzzy
+ pybabel compile -d translations -l pt --use-fuzzy
# Process everything related to gettext translations.
locale: locale-update locale-compile
# Run the jinja2 templating engine to expand templates to HTML
-# incorporating translations.
+# incorporating translations. NOTE; likely NOT needed when another
+# templating is happening -- like in a Flask settlement.
template: locale-compile
./template.py
diff --git a/talerbackoffice/backoffice/templates/backoffice.html.j2
b/talerbackoffice/backoffice/templates/backoffice.html
similarity index 100%
rename from talerbackoffice/backoffice/templates/backoffice.html.j2
rename to talerbackoffice/backoffice/templates/backoffice.html
diff --git a/talerbackoffice/backoffice/templates/base.html.j2
b/talerbackoffice/backoffice/templates/base.html
similarity index 100%
rename from talerbackoffice/backoffice/templates/base.html.j2
rename to talerbackoffice/backoffice/templates/base.html
diff --git a/talerbackoffice/backoffice/templates/javascript.html.j2
b/talerbackoffice/backoffice/templates/javascript.html
similarity index 100%
rename from talerbackoffice/backoffice/templates/javascript.html.j2
rename to talerbackoffice/backoffice/templates/javascript.html
diff --git a/talerbackoffice/backoffice/templates/locale/babel.map
b/talerbackoffice/backoffice/templates/translations/babel.map
similarity index 52%
rename from talerbackoffice/backoffice/templates/locale/babel.map
rename to talerbackoffice/backoffice/templates/translations/babel.map
index 72b6f99..d596257 100644
--- a/talerbackoffice/backoffice/templates/locale/babel.map
+++ b/talerbackoffice/backoffice/templates/translations/babel.map
@@ -1,12 +1,9 @@
[extractors]
jinja2 = i18nfix:babel_extract
-[jinja2: **.j2]
-encoding = utf-8
-lstrip_blocks = True
-trim_blocks = True
+[python: **.py]
-[jinja2: **.j2.inc]
+[jinja2: **/templates/**.html]
encoding = utf-8
lstrip_blocks = True
-ltrim_blocks = True
+trim_blocks = True
diff --git
a/talerbackoffice/backoffice/templates/locale/de/LC_MESSAGES/messages.po
b/talerbackoffice/backoffice/templates/translations/de/LC_MESSAGES/messages.po
similarity index 100%
rename from
talerbackoffice/backoffice/templates/locale/de/LC_MESSAGES/messages.po
rename to
talerbackoffice/backoffice/templates/translations/de/LC_MESSAGES/messages.po
diff --git
a/talerbackoffice/backoffice/templates/locale/en/LC_MESSAGES/messages.po
b/talerbackoffice/backoffice/templates/translations/en/LC_MESSAGES/messages.po
similarity index 100%
rename from
talerbackoffice/backoffice/templates/locale/en/LC_MESSAGES/messages.po
rename to
talerbackoffice/backoffice/templates/translations/en/LC_MESSAGES/messages.po
diff --git
a/talerbackoffice/backoffice/templates/locale/es/LC_MESSAGES/messages.po
b/talerbackoffice/backoffice/templates/translations/es/LC_MESSAGES/messages.po
similarity index 100%
rename from
talerbackoffice/backoffice/templates/locale/es/LC_MESSAGES/messages.po
rename to
talerbackoffice/backoffice/templates/translations/es/LC_MESSAGES/messages.po
diff --git
a/talerbackoffice/backoffice/templates/locale/fr/LC_MESSAGES/messages.po
b/talerbackoffice/backoffice/templates/translations/fr/LC_MESSAGES/messages.po
similarity index 100%
rename from
talerbackoffice/backoffice/templates/locale/fr/LC_MESSAGES/messages.po
rename to
talerbackoffice/backoffice/templates/translations/fr/LC_MESSAGES/messages.po
diff --git
a/talerbackoffice/backoffice/templates/locale/it/LC_MESSAGES/messages.po
b/talerbackoffice/backoffice/templates/translations/it/LC_MESSAGES/messages.po
similarity index 100%
rename from
talerbackoffice/backoffice/templates/locale/it/LC_MESSAGES/messages.po
rename to
talerbackoffice/backoffice/templates/translations/it/LC_MESSAGES/messages.po
diff --git a/talerbackoffice/backoffice/templates/locale/messages.pot
b/talerbackoffice/backoffice/templates/translations/messages.pot
similarity index 100%
rename from talerbackoffice/backoffice/templates/locale/messages.pot
rename to talerbackoffice/backoffice/templates/translations/messages.pot
diff --git
a/talerbackoffice/backoffice/templates/locale/pt/LC_MESSAGES/messages.po
b/talerbackoffice/backoffice/templates/translations/pt/LC_MESSAGES/messages.po
similarity index 100%
rename from
talerbackoffice/backoffice/templates/locale/pt/LC_MESSAGES/messages.po
rename to
talerbackoffice/backoffice/templates/translations/pt/LC_MESSAGES/messages.po
diff --git
a/talerbackoffice/backoffice/templates/locale/ru/LC_MESSAGES/messages.po
b/talerbackoffice/backoffice/templates/translations/ru/LC_MESSAGES/messages.po
similarity index 100%
rename from
talerbackoffice/backoffice/templates/locale/ru/LC_MESSAGES/messages.po
rename to
talerbackoffice/backoffice/templates/translations/ru/LC_MESSAGES/messages.po
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-backoffice] branch master updated: Rename 'locale' directory to 'translations'.,
gnunet <=