aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtemplate.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/template.py b/template.py
index 179e32a7..ed8f47eb 100755
--- a/template.py
+++ b/template.py
@@ -1,4 +1,4 @@
1#!/usr/bin/env python 1#!/usr/bin/env python3
2# This file is in the public domain. 2# This file is in the public domain.
3# 3#
4# This script runs the jinga2 templating engine on an input template-file 4# This script runs the jinga2 templating engine on an input template-file
@@ -15,6 +15,7 @@ import gettext
15import jinja2 15import jinja2
16import glob 16import glob
17import codecs 17import codecs
18import os
18 19
19env = jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.dirname(__file__)), 20env = jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
20 extensions=["jinja2.ext.i18n"], 21 extensions=["jinja2.ext.i18n"],
@@ -51,5 +52,6 @@ for in_file in glob.glob("*.j2"):
51 52
52 content = tmpl.render(lang=locale, url=url, self_localized=self_localized, url_localized=url_localized) 53 content = tmpl.render(lang=locale, url=url, self_localized=self_localized, url_localized=url_localized)
53 out_name = "./" + locale + "/" + in_file.rstrip(".j2") 54 out_name = "./" + locale + "/" + in_file.rstrip(".j2")
55 os.makedirs("./" + locale, exist_ok=True)
54 with codecs.open(out_name, "w", "utf-8") as f: 56 with codecs.open(out_name, "w", "utf-8") as f:
55 f.write(content) 57 f.write(content)