gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-www] branch master updated: enable internationalizat


From: gnunet
Subject: [GNUnet-SVN] [taler-www] branch master updated: enable internationalization of SVGs
Date: Tue, 22 Aug 2017 21:15:14 +0200

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

grothoff pushed a commit to branch master
in repository www.

The following commit(s) were added to refs/heads/master by this push:
     new c2920a9  enable internationalization of SVGs
c2920a9 is described below

commit c2920a90ae0a75f5f98d13702aecc9233028e4c9
Author: Christian Grothoff <address@hidden>
AuthorDate: Tue Aug 22 21:14:45 2017 +0200

    enable internationalization of SVGs
---
 architecture.html.j2                          | 2 +-
 citizens.html.j2                              | 4 ++--
 developers.html.j2                            | 2 +-
 images/{logo-2017-fr.svg => logo-2017.fr.svg} | 0
 index.html.j2                                 | 2 +-
 merchants.html.j2                             | 2 +-
 template.py                                   | 8 ++++++++
 7 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/architecture.html.j2 b/architecture.html.j2
index 17fd0c0..21fd6ba 100644
--- a/architecture.html.j2
+++ b/architecture.html.j2
@@ -11,6 +11,6 @@
 </div>
 
 <div class="container">
-  <img width="100%" src="{{ url('images/taler-arch-full.svg') }}"></img>
+  <img width="100%" src="{{ svg_localized('images/taler-arch-full') }}"></img>
 </div>
 {% endblock body_content %}
diff --git a/citizens.html.j2 b/citizens.html.j2
index af3f0e6..2d5b677 100644
--- a/citizens.html.j2
+++ b/citizens.html.j2
@@ -133,8 +133,8 @@
    </div>
 
    <div class="col-lg-6">
-     <img src="{{ url('images/citizen.svg') }}"
-          alt="customer perspective"
+     <img src="{{ svg_localized('images/citizen') }}"
+          alt="{{ _("customer perspective") }}"
           style="float: right; margin: 5px 5px 5px 5px;" width="100%">
    </div>
 
diff --git a/developers.html.j2 b/developers.html.j2
index 3970d46..33107fe 100644
--- a/developers.html.j2
+++ b/developers.html.j2
@@ -152,7 +152,7 @@
         {% endtrans %}
      </p>
 
-      <img src="{{ url('images/system.svg') }}" alt="system overview" 
style="float: right; margin: 50px 5px 5px 5px;" width="50%">
+      <img src="{{ svg_localized('images/system') }}" alt="{{_("system 
overview")}}" style="float: right; margin: 50px 5px 5px 5px;" width="50%">
       <ol>
          <li>
                {% trans %}
diff --git a/images/logo-2017-fr.svg b/images/logo-2017.fr.svg
similarity index 100%
rename from images/logo-2017-fr.svg
rename to images/logo-2017.fr.svg
diff --git a/index.html.j2 b/index.html.j2
index 8ba98bf..9378d93 100644
--- a/index.html.j2
+++ b/index.html.j2
@@ -3,7 +3,7 @@
 <!-- Jumbotron -->
 <div class="jumbotron">
   <div style="height: 40vh">
-    <img alt="GNU Taler logo" 
style="object-fit:contain;width:100%;height:100%" class="center-block" src="{{ 
url('images/logo-2017.svg') }}" />
+    <img alt="{{ _("GNU Taler logo")}}" 
style="object-fit:contain;width:100%;height:100%" class="center-block" src="{{ 
svg_localized('images/logo-2017') }}" />
   </div>
 
   <div class="container text-center">
diff --git a/merchants.html.j2 b/merchants.html.j2
index 56425d4..4b55cb0 100644
--- a/merchants.html.j2
+++ b/merchants.html.j2
@@ -176,7 +176,7 @@
     </p>
  </div>
   <div class="col-lg-6">
-    <img src="{{ url('images/backend.svg') }}" alt="customer perspective" 
style="float: right; margin: 5px 5px 5px 5px;" width="100%">
+    <img src="{{ svg_localized('images/backend') }}" alt="{{ _("customer 
perspective")}}" style="float: right; margin: 5px 5px 5px 5px;" width="100%">
   </div>
 </div> <!-- /container -->
 {% endblock body_content %}
diff --git a/template.py b/template.py
index 450bd3d..e0e3dac 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)

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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