summaryrefslogtreecommitdiff
path: root/template.py
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 /template.py
parent827d62def4a38325262226893e3fab942aeb4050 (diff)
downloadwww-c2920a90ae0a75f5f98d13702aecc9233028e4c9.tar.gz
www-c2920a90ae0a75f5f98d13702aecc9233028e4c9.tar.bz2
www-c2920a90ae0a75f5f98d13702aecc9233028e4c9.zip
enable internationalization of SVGs
Diffstat (limited to 'template.py')
-rwxr-xr-xtemplate.py8
1 files changed, 8 insertions, 0 deletions
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)