# HG changeset patch # User Jens-Uwe Grooss # Date 1580746842 -3600 # Node ID 878b81ffb8f79ef5ed9fcfe28a5f9dce0a658788 # Parent 4fae7e615b2b67a5a38bc8b8ab5a975fd675de4e added html snippets in english language diff -r 4fae7e615b2b -r 878b81ffb8f7 eskp.py --- a/eskp.py Mon Feb 03 16:20:55 2020 +0100 +++ b/eskp.py Mon Feb 03 17:20:42 2020 +0100 @@ -49,6 +49,14 @@ content = publish_parts(rst_data, writer_name='html', settings_overrides=overrides)['html_body'] return content +def get_html_content(filename, overrides=None): + html_content = u"" + filename = os.path.join(ESKP_PATH, filename) + if os.path.isfile(filename): + with codecs.open(filename, 'r', 'utf-8') as f: + html_content = f.read() + + return html_content def get_newest_date(): getdates = get_valid_dates(FILES) @@ -279,7 +287,11 @@ def ozoneloss_uvmap(): filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_uvmap.rst") content = get_content(filename) - return render_template("/ozoneloss_uvmap.html", act="ozoneloss/uvmap", content=content) + + htmlfile = os.path.join("templates", get_locale(), "html", "uvi_table.html") + html_content = get_html_content(htmlfile) + return render_template("/ozoneloss_uvmap.html", act="ozoneloss/uvmap", content=content, + html_content=html_content) @app.route("/ozoneloss/vpsc") @@ -291,22 +303,31 @@ @app.route("/ozoneloss/uvi", methods=['GET']) def ozoneloss_uvi(): - # XXX check 'POST' does not work filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_uvi.rst") content = get_content(filename) + htmlfile = os.path.join("templates", get_locale(), "html", "ozoneloss_uvi_form.html") + html_content = get_html_content(htmlfile) + htmlfile = os.path.join("templates", get_locale(), "html", "uvi_table.html") + html_table = get_html_content(htmlfile) lat = 50. o3offset = 50. figname = "uvincr_lat%0.3i_do3%0.3i.svg" % (lat, o3offset) + button_text = _("Graph anzeigen") return render_template('ozoneloss_uvi.html', act="ozoneloss/uvi", content=content, figname=figname, - alt=_(u"UV increase at {{lat}} degrees N for {{o3offset}} DU ozone depletion")) + alt=_(u"UV increase at {{lat}} degrees N for {{o3offset}} DU ozone depletion"), + html_content=html_content, html_table=html_table, button_text=button_text) @app.route("/ozoneloss/uvi_graph", methods=['POST']) def ozoneloss_uvi_graph(): filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_uvi.rst") content = get_content(filename) + htmlfile = os.path.join("templates", get_locale(), "html", "ozoneloss_uvi_form.html") + html_content = get_html_content(htmlfile) + htmlfile = os.path.join("templates", get_locale(), "html", "uvi_table.html") + html_table = get_html_content(htmlfile) latstr = request.form['Gradzahl'] o3offsetstr = request.form['Dobson-Unit'] @@ -321,9 +342,12 @@ lat = -float(latstr2) figname = "uvincr_lat%0.3i_do3%0.3i.svg" % (lat, float(o3offsetstr)) + button_text = _("Graph anzeigen") return render_template('graph.html', act="ozoneloss_uvi_graph", content=content, figname=figname, - o3offsetstr=o3offsetstr, latstr=latstr) + alt=_(u"UV increase at {{lat}} degrees N for {{o3offset}} DU ozone depletion"), + o3offsetstr=o3offsetstr, latstr=latstr, html_content=html_content, + html_table=html_table, button_text=button_text) @app.route("/ozoneloss/decadal") def ozoneloss_decadal(): diff -r 4fae7e615b2b -r 878b81ffb8f7 templates/de/html/ozoneloss_uvi_form.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/de/html/ozoneloss_uvi_form.html Mon Feb 03 17:20:42 2020 +0100 @@ -0,0 +1,29 @@ +
+ +

+

UV-Index für + + DU zusätzlichen Ozonverlust bei der Breite + + :     + +

+

+ +
+
diff -r 4fae7e615b2b -r 878b81ffb8f7 templates/de/html/uvi_table.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/de/html/uvi_table.html Mon Feb 03 17:20:42 2020 +0100 @@ -0,0 +1,44 @@ + +Die unten stehenden Tabelle gibt einen Anhaltspunkt für die Bedeutung der verschiedenen UV-Indices: +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
UV-IndexBewertungSchutz
0 – 2niedrigKein Schutz erforderlich
3 – 5mäßigSchutz erforderlich: Hut, T-Shirt, Sonnenbrille, Sonnencreme
6 – 7hochSchutz erforderlich: Hut, T-Shirt, Sonnenbrille, Sonnencreme
8 – 10sehr hochzusätzlicher Schutz erforderlich: Aufenthalt im Freien möglichst vermeiden
≥ 11extremzusätzlicher Schutz erforderlich: Aufenthalt im Freien möglichst vermeiden
+
Quelle: + Schweizerisches Bundesamt für Gesundheit
+ diff -r 4fae7e615b2b -r 878b81ffb8f7 templates/en/html/ozoneloss_uvi_form.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/en/html/ozoneloss_uvi_form.html Mon Feb 03 17:20:42 2020 +0100 @@ -0,0 +1,29 @@ +
+ +

+

UV index for + + DU additional ozone loss at latitude + + :     + +

+

+ +
+
diff -r 4fae7e615b2b -r 878b81ffb8f7 templates/en/html/uvi_table.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/en/html/uvi_table.html Mon Feb 03 17:20:42 2020 +0100 @@ -0,0 +1,44 @@ + +The table below gives an indication of the importance of the different UV indices: +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
UV-IndexEvaluationProtection
0 – 2low No protection required
3 – 5moderateProtection required: hat, T-shirt, sunglasses, sunscreen
6 – 7highProtection required: hat, T-shirt, sunglasses, sunscreen
8 – 10very highadditional protection required: avoid staying outside if possible
≥ 11extremeadditional protection required: avoid staying outside if possible
+
Source: + Schweizerisches Bundesamt für Gesundheit
+ diff -r 4fae7e615b2b -r 878b81ffb8f7 templates/graph.html --- a/templates/graph.html Mon Feb 03 16:20:55 2020 +0100 +++ b/templates/graph.html Mon Feb 03 17:20:42 2020 +0100 @@ -54,7 +54,7 @@ :     - +

@@ -62,52 +62,10 @@
-
+{{ html_table|safe }}
- -Die unten stehenden Tabelle gibt einen Anhaltspunkt für die Bedeutung der verschiedenen UV-Indices:
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
UV-IndexBewertungSchutz
0 – 2niedrigKein Schutz erforderlich
3 – 5mäßigSchutz erforderlich: Hut, T-Shirt, Sonnenbrille, Sonnencreme
6 – 7hochSchutz erforderlich: Hut, T-Shirt, Sonnenbrille, Sonnencreme
8 – 10sehr hochzusätzlicher Schutz erforderlich: Aufenthalt im Freien möglichst vermeiden
≥ 11extremzusätzlicher Schutz erforderlich: Aufenthalt im Freien möglichst vermeiden
-
Quelle: Schweizerisches Bundesamt für Gesundheit www.uv-index.ch/de/uvindex.html
-
{{ content_explanation|safe }} diff -r 4fae7e615b2b -r 878b81ffb8f7 templates/ozoneloss_uvi.html --- a/templates/ozoneloss_uvi.html Mon Feb 03 16:20:55 2020 +0100 +++ b/templates/ozoneloss_uvi.html Mon Feb 03 17:20:42 2020 +0100 @@ -9,83 +9,13 @@
-
- -

-

UV-Index für - - DU zusätzlichen Ozonverlust bei der Breite - - :     - -

-

- -
-
+{{ html_content|safe }}
-{{ alt }} - +{{ alt }}
+{{ html_table|safe }}
- -Die unten stehenden Tabelle gibt einen Anhaltspunkt für die Bedeutung der verschiedenen UV-Indices:
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
UV-IndexBewertungSchutz
0 – 2niedrigKein Schutz erforderlich
3 – 5mäßigSchutz erforderlich: Hut, T-Shirt, Sonnenbrille, Sonnencreme
6 – 7hochSchutz erforderlich: Hut, T-Shirt, Sonnenbrille, Sonnencreme
8 – 10sehr hochzusätzlicher Schutz erforderlich: Aufenthalt im Freien möglichst vermeiden
≥ 11extremzusätzlicher Schutz erforderlich: Aufenthalt im Freien möglichst vermeiden
-
Quelle: Schweizerisches Bundesamt für Gesundheit www.uv-index.ch/de/uvindex.html
-
{{ content_explanation|safe }} diff -r 4fae7e615b2b -r 878b81ffb8f7 templates/ozoneloss_uvmap.html --- a/templates/ozoneloss_uvmap.html Mon Feb 03 16:20:55 2020 +0100 +++ b/templates/ozoneloss_uvmap.html Mon Feb 03 17:20:42 2020 +0100 @@ -23,6 +23,7 @@
Die unten stehenden Tabelle gibt einen Anhaltspunkt für die Bedeutung der verschiedenen UV-Indices: +

@@ -62,7 +63,8 @@
zusätzlicher Schutz erforderlich: Aufenthalt im Freien möglichst vermeiden
-
Quelle: Schweizerisches Bundesamt für Gesundheit www.uv-index.ch/de/uvindex.html
+
Quelle: + Schweizerisches Bundesamt für Gesundheit
diff -r 4fae7e615b2b -r 878b81ffb8f7 translations/de/LC_MESSAGES/messages.mo Binary file translations/de/LC_MESSAGES/messages.mo has changed diff -r 4fae7e615b2b -r 878b81ffb8f7 translations/de/LC_MESSAGES/messages.po --- a/translations/de/LC_MESSAGES/messages.po Mon Feb 03 16:20:55 2020 +0100 +++ b/translations/de/LC_MESSAGES/messages.po Mon Feb 03 17:20:42 2020 +0100 @@ -114,7 +114,7 @@ #: eskp.py:303 #, fuzzy msgid "UV increase at {{lat}} degrees N for {{o3offset}} DU ozone depletion" -msgstr "UV Anstieg bei 52 Grad N für 50 DU Ozonverlust" +msgstr "UV Anstieg bei {{lat}} Grad N für {{o3offset}} DU Ozonverlust" #: eskp.py:375 #, python-format @@ -125,6 +125,5 @@ msgid "This information is not available!" msgstr "Diese Information steht nicht zur Verfügung" -#~ msgid "UV increase at 52 degrees N for 50 DU ozone depletion" -#~ msgstr "UV Anstieg bei 52 Grad N für 50 DU Ozonverlust" - +msgid "Graph anzeigen" +msgstr "Graph anzeigen" diff -r 4fae7e615b2b -r 878b81ffb8f7 translations/en/LC_MESSAGES/messages.mo Binary file translations/en/LC_MESSAGES/messages.mo has changed diff -r 4fae7e615b2b -r 878b81ffb8f7 translations/en/LC_MESSAGES/messages.po --- a/translations/en/LC_MESSAGES/messages.po Mon Feb 03 16:20:55 2020 +0100 +++ b/translations/en/LC_MESSAGES/messages.po Mon Feb 03 17:20:42 2020 +0100 @@ -80,3 +80,5 @@ msgid "This information is not available!" msgstr "This information is not available!" +msgid "Graph anzeigen" +msgstr "Show figure"