aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-08-22 21:14:45 +0200
committerChristian Grothoff <christian@grothoff.org>2017-08-22 21:14:45 +0200
commitc2920a90ae0a75f5f98d13702aecc9233028e4c9 (patch)
treec304c0c42ca7dc57b879b2eb9ae526e5ff962460
parent827d62def4a38325262226893e3fab942aeb4050 (diff)
downloadwww-c2920a90ae0a75f5f98d13702aecc9233028e4c9.tar.gz
www-c2920a90ae0a75f5f98d13702aecc9233028e4c9.zip
enable internationalization of SVGs
-rw-r--r--architecture.html.j22
-rw-r--r--citizens.html.j24
-rw-r--r--developers.html.j22
-rw-r--r--images/logo-2017.fr.svg (renamed from images/logo-2017-fr.svg)0
-rw-r--r--index.html.j22
-rw-r--r--merchants.html.j22
-rwxr-xr-xtemplate.py8
7 files changed, 14 insertions, 6 deletions
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 @@
11</div> 11</div>
12 12
13<div class="container"> 13<div class="container">
14 <img width="100%" src="{{ url('images/taler-arch-full.svg') }}"></img> 14 <img width="100%" src="{{ svg_localized('images/taler-arch-full') }}"></img>
15</div> 15</div>
16{% endblock body_content %} 16{% 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 @@
133 </div> 133 </div>
134 134
135 <div class="col-lg-6"> 135 <div class="col-lg-6">
136 <img src="{{ url('images/citizen.svg') }}" 136 <img src="{{ svg_localized('images/citizen') }}"
137 alt="customer perspective" 137 alt="{{ _("customer perspective") }}"
138 style="float: right; margin: 5px 5px 5px 5px;" width="100%"> 138 style="float: right; margin: 5px 5px 5px 5px;" width="100%">
139 </div> 139 </div>
140 140
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 @@
152 {% endtrans %} 152 {% endtrans %}
153 </p> 153 </p>
154 154
155 <img src="{{ url('images/system.svg') }}" alt="system overview" style="float: right; margin: 50px 5px 5px 5px;" width="50%"> 155 <img src="{{ svg_localized('images/system') }}" alt="{{_("system overview")}}" style="float: right; margin: 50px 5px 5px 5px;" width="50%">
156 <ol> 156 <ol>
157 <li> 157 <li>
158 {% trans %} 158 {% trans %}
diff --git a/images/logo-2017-fr.svg b/images/logo-2017.fr.svg
index bee6899f..bee6899f 100644
--- a/images/logo-2017-fr.svg
+++ b/images/logo-2017.fr.svg
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 @@
3<!-- Jumbotron --> 3<!-- Jumbotron -->
4<div class="jumbotron"> 4<div class="jumbotron">
5 <div style="height: 40vh"> 5 <div style="height: 40vh">
6 <img alt="GNU Taler logo" style="object-fit:contain;width:100%;height:100%" class="center-block" src="{{ url('images/logo-2017.svg') }}" /> 6 <img alt="{{ _("GNU Taler logo")}}" style="object-fit:contain;width:100%;height:100%" class="center-block" src="{{ svg_localized('images/logo-2017') }}" />
7 </div> 7 </div>
8 8
9 <div class="container text-center"> 9 <div class="container text-center">
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 @@
176 </p> 176 </p>
177 </div> 177 </div>
178 <div class="col-lg-6"> 178 <div class="col-lg-6">
179 <img src="{{ url('images/backend.svg') }}" alt="customer perspective" style="float: right; margin: 5px 5px 5px 5px;" width="100%"> 179 <img src="{{ svg_localized('images/backend') }}" alt="{{ _("customer perspective")}}" style="float: right; margin: 5px 5px 5px 5px;" width="100%">
180 </div> 180 </div>
181</div> <!-- /container --> 181</div> <!-- /container -->
182{% endblock body_content %} 182{% 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"):
40 def url_localized(filename): 40 def url_localized(filename):
41 return "../" + locale + "/" + filename 41 return "../" + locale + "/" + filename
42 42
43 def svg_localized(filename):
44 lf = filename + "." + locale + ".svg"
45 if "en" == locale or not os.path.isfile (lf):
46 return "../" + filename + ".svg"
47 else:
48 return "../" + lf
49
43 def url(x): 50 def url(x):
44 # TODO: look at the app root environment variable 51 # TODO: look at the app root environment variable
45 # TODO: check if file exists 52 # TODO: check if file exists
@@ -63,6 +70,7 @@ for in_file in glob.glob("*.j2"):
63 url=url, 70 url=url,
64 self_localized=self_localized, 71 self_localized=self_localized,
65 url_localized=url_localized, 72 url_localized=url_localized,
73 svg_localized=svg_localized,
66 filename=name + "." + ext) 74 filename=name + "." + ext)
67 out_name = "./" + locale + "/" + in_file.rstrip(".j2") 75 out_name = "./" + locale + "/" + in_file.rstrip(".j2")
68 os.makedirs("./" + locale, exist_ok=True) 76 os.makedirs("./" + locale, exist_ok=True)