From c2920a90ae0a75f5f98d13702aecc9233028e4c9 Mon Sep 17 00:00:00 2001
From: Christian Grothoff
Date: Tue, 22 Aug 2017 21:14:45 +0200
Subject: enable internationalization of SVGs
---
architecture.html.j2 | 2 +-
citizens.html.j2 | 4 ++--
developers.html.j2 | 2 +-
images/logo-2017-fr.svg | 44 --------------------------------------------
images/logo-2017.fr.svg | 44 ++++++++++++++++++++++++++++++++++++++++++++
index.html.j2 | 2 +-
merchants.html.j2 | 2 +-
template.py | 8 ++++++++
8 files changed, 58 insertions(+), 50 deletions(-)
delete mode 100644 images/logo-2017-fr.svg
create mode 100644 images/logo-2017.fr.svg
diff --git a/architecture.html.j2 b/architecture.html.j2
index 17fd0c00..21fd6ba7 100644
--- a/architecture.html.j2
+++ b/architecture.html.j2
@@ -11,6 +11,6 @@
-
+
{% endblock body_content %}
diff --git a/citizens.html.j2 b/citizens.html.j2
index af3f0e6c..2d5b677d 100644
--- a/citizens.html.j2
+++ b/citizens.html.j2
@@ -133,8 +133,8 @@
-
diff --git a/developers.html.j2 b/developers.html.j2
index 3970d464..33107fe2 100644
--- a/developers.html.j2
+++ b/developers.html.j2
@@ -152,7 +152,7 @@
{% endtrans %}
-
+
-
{% trans %}
diff --git a/images/logo-2017-fr.svg b/images/logo-2017-fr.svg
deleted file mode 100644
index bee6899f..00000000
--- a/images/logo-2017-fr.svg
+++ /dev/null
@@ -1,44 +0,0 @@
-
diff --git a/images/logo-2017.fr.svg b/images/logo-2017.fr.svg
new file mode 100644
index 00000000..bee6899f
--- /dev/null
+++ b/images/logo-2017.fr.svg
@@ -0,0 +1,44 @@
+
diff --git a/index.html.j2 b/index.html.j2
index 8ba98bf5..9378d937 100644
--- a/index.html.j2
+++ b/index.html.j2
@@ -3,7 +3,7 @@
-
+
diff --git a/merchants.html.j2 b/merchants.html.j2
index 56425d40..4b55cb00 100644
--- a/merchants.html.j2
+++ b/merchants.html.j2
@@ -176,7 +176,7 @@
-
+
{% endblock body_content %}
diff --git a/template.py b/template.py
index 450bd3db..e0e3dacc 100755
--- a/template.py
+++ b/template.py
@@ -40,6 +40,13 @@ for in_file in glob.glob("*.j2"):
def url_localized(filename):
return "../" + locale + "/" + filename
+ def svg_localized(filename):
+ lf = filename + "." + locale + ".svg"
+ if "en" == locale or not os.path.isfile (lf):
+ return "../" + filename + ".svg"
+ else:
+ return "../" + lf
+
def url(x):
# TODO: look at the app root environment variable
# TODO: check if file exists
@@ -63,6 +70,7 @@ for in_file in glob.glob("*.j2"):
url=url,
self_localized=self_localized,
url_localized=url_localized,
+ svg_localized=svg_localized,
filename=name + "." + ext)
out_name = "./" + locale + "/" + in_file.rstrip(".j2")
os.makedirs("./" + locale, exist_ok=True)
--
cgit v1.2.3