gnunet-svn
[Top][All Lists]
Advanced

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

[www_shared] branch master updated: better error messages


From: gnunet
Subject: [www_shared] branch master updated: better error messages
Date: Wed, 17 Feb 2021 15:09:53 +0100

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

dold pushed a commit to branch master
in repository www_shared.

The following commit(s) were added to refs/heads/master by this push:
     new 99a0de7  better error messages
99a0de7 is described below

commit 99a0de7cac0033db10a0bed9f476900ece1e402a
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed Feb 17 15:07:30 2021 +0100

    better error messages
---
 site.py | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/site.py b/site.py
index 2519784..344a493 100644
--- a/site.py
+++ b/site.py
@@ -147,14 +147,23 @@ class gen_site:
                 # locale = os.path.basename(l[:-1])
                 locale = l
 
-                tr = gettext.translation("messages",
-                                         localedir="locale",
-                                         languages=[locale])
+
+                try:
+                    tr = gettext.translation("messages",
+                                             localedir="locale",
+                                             languages=[locale])
+                except FileNotFoundError as e:
+                    print(f"WARNING: unable to find translations for locale 
'{locale}'", file=sys.stderr)
+                    continue
 
                 tr.gettext = i18nfix.wrap_gettext(tr.gettext)
 
                 env.install_gettext_translations(tr, newstyle=True)
 
+                if locale not in conf["langs_full"]:
+                    print(f"WARNING: skipping '{locale}, as 'langs_full' is 
not configured'", file=sys.stderr)
+                    continue
+
                 content = tmpl.render(lang=locale,
                                       lang_full=conf["langs_full"][locale],
                                       url=url,
@@ -186,7 +195,7 @@ class gen_site:
 
                 try:
                     langdir.mkdir(parents=True, exist_ok=True)
-                except e as FileNotFoundError:
+                except FileNotFoundError as e:
                     print(e)
 
                 with codecs.open(out_name, "w", encoding='utf-8') as f:

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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