taler-www

Main taler.net website
Log | Files | Refs | Submodules | README | LICENSE

commit 592850e144e38520fb166ee490c25b0283257d16
parent 5512942ea77aa8a474a0163f8ef3097d678f8675
Author: tg(x) <*@tg-x.net>
Date:   Thu, 19 Jan 2017 23:45:29 +0100

i18n: fix js, lang switcher

Diffstat:
Mabout.html.j2 | 2+-
Mcitizens.html.j2 | 2+-
Mcommon/header.inc.j2 | 1+
Mcommon/navigation.inc.j2 | 10+++++-----
Mdevelopers.html.j2 | 2+-
Mfinancial-news.html.j2 | 2+-
Mgovernments.html.j2 | 2+-
Mindex.html.j2 | 2+-
Minvestors.html.j2 | 2+-
Dlang.css | 60------------------------------------------------------------
Dlang.js | 84-------------------------------------------------------------------------------
Amenu.js | 36++++++++++++++++++++++++++++++++++++
Mmerchants.html.j2 | 2+-
Mnews.html.j2 | 2+-
Mwallet.html.j2 | 2+-
15 files changed, 52 insertions(+), 159 deletions(-)

diff --git a/about.html.j2 b/about.html.j2 @@ -4,7 +4,7 @@ <meta name="description" content=""> <!--# include file="common/header.{{ _("en") }}.inc" --> </head> - <body class="en" onload="loadLang();"> + <body> <div class="container"> <!--# include file="common/navigation.{{ _("en") }}.inc" --> <!-- Jumbotron --> diff --git a/citizens.html.j2 b/citizens.html.j2 @@ -4,7 +4,7 @@ <meta name="description" content=""> <!--# include file="common/header.{{ _("en") }}.inc" --> </head> - <body class="en" onload="loadLang();"> + <body> <div class="container"> <!--# include file="common/navigation.{{ _("en") }}.inc" --> <!-- Jumbotron --> diff --git a/common/header.inc.j2 b/common/header.inc.j2 @@ -35,6 +35,7 @@ <link href="/justified-nav.css" rel="stylesheet"> <link href="/styles.css" rel="stylesheet"> + <script src="/menu.js"></script> <script src="/dist/js/jquery-1.11.1.min.js"></script> <script src="/dist/js/bootstrap.min.js"></script> diff --git a/common/navigation.inc.j2 b/common/navigation.inc.j2 @@ -22,10 +22,10 @@ </div> <div class="navbar navbar-default navbar-fixed-bottom" role="navigation"> <div class="container lang-slector"> - <a href="/en/"><img src="/images/gb.png" height="15" width="23" alt="English"></a> - <a href="/de/"><img src="/images/de.png" height="15" width="25" alt="Deutsch"></a> - <a href="/fr/"><img src="/images/fr.png" height="15" width="22" alt="Français"></a> - <a href="/it/"><img src="/images/it.png" height="15" width="22" alt="Italiano"></a> - <a href="/es/"><img src="/images/es.png" height="15" width="23" alt="Español"></a> + <a href="#" onclick="location.pathname=location.pathname.replace(/^.../, '/en')"><img src="/images/gb.png" height="15" width="23" alt="English"></a> + <a href="#" onclick="location.pathname=location.pathname.replace(/^.../, '/de')"><img src="/images/de.png" height="15" width="25" alt="Deutsch"></a> + <a href="#" onclick="location.pathname=location.pathname.replace(/^.../, '/fr')"><img src="/images/fr.png" height="15" width="22" alt="Français"></a> + <a href="#" onclick="location.pathname=location.pathname.replace(/^.../, '/it')"><img src="/images/it.png" height="15" width="22" alt="Italiano"></a> + <a href="#" onclick="location.pathname=location.pathname.replace(/^.../, '/es')"><img src="/images/es.png" height="15" width="23" alt="Español"></a> </div> </div> diff --git a/developers.html.j2 b/developers.html.j2 @@ -4,7 +4,7 @@ <meta name="description" content=""> <!--# include file="common/header.{{ _("en") }}.inc" --> </head> - <body class="en" onload="loadLang();"> + <body> <div class="container"> <!--# include file="common/navigation.{{ _("en") }}.inc" --> <!-- Jumbotron --> diff --git a/financial-news.html.j2 b/financial-news.html.j2 @@ -6,7 +6,7 @@ <meta name="description" content=""> <!--# include file="common/header.{{ _("en") }}.inc" --> </head> - <body class="en" onLoad="loadLang();"> + <body> <div class="container"> <!--# include file="common/navigation.{{ _("en") }}.inc" --> <!-- Jumbotron --> diff --git a/governments.html.j2 b/governments.html.j2 @@ -4,7 +4,7 @@ <meta name="description" content=""> <!--# include file="common/header.{{ _("en") }}.inc" --> </head> - <body class="en" onload="loadLang();"> + <body> <div class="container"> <!--# include file="common/navigation.{{ _("en") }}.inc" --> <!-- Jumbotron --> diff --git a/index.html.j2 b/index.html.j2 @@ -4,7 +4,7 @@ <meta name="description" content="Anonymous electronic payments for civil society"> <!--# include file="common/header.{{ _("en") }}.inc" --> </head> - <body class="en" onload="loadLang();"> + <body> <div class="container"> <!--# include file="common/navigation.{{ _("en") }}.inc" --> <!-- Jumbotron --> diff --git a/investors.html.j2 b/investors.html.j2 @@ -4,7 +4,7 @@ <meta name="description" content=""> <!--# include file="common/header.{{ _("en") }}.inc" --> </head> - <body class="en" onload="loadLang();"> + <body> <div class="container"> <!--# include file="common/navigation.{{ _("en") }}.inc" --> <!-- Jumbotron --> diff --git a/lang.css b/lang.css @@ -1,60 +0,0 @@ -body.en :lang(de) { - display: none; -} -body.en :lang(fr) { - display: none; -} -body.en :lang(it) { - display: none; -} -body.en :lang(es) { - display: none; -} -body.de :lang(en) { - display: none; -} -body.de :lang(fr) { - display: none; -} -body.de :lang(it) { - display: none; -} -body.de :lang(es) { - display: none; -} -body.fr :lang(de) { - display: none; -} -body.fr :lang(en) { - display: none; -} -body.fr :lang(it) { - display: none; -} -body.fr :lang(es) { - display: none; -} -body.it :lang(de) { - display: none; -} -body.it :lang(en) { - display: none; -} -body.it :lang(fr) { - display: none; -} -body.it :lang(es) { - display: none; -} -body.es :lang(de) { - display: none; -} -body.es :lang(en) { - display: none; -} -body.es :lang(fr) { - display: none; -} -body.es :lang(it) { - display: none; -} diff --git a/lang.js b/lang.js @@ -1,84 +0,0 @@ -/** - * @licstart The following is the entire license notice for the - * JavaScript code in this page. - * - * Copyright (C) 2014 GNUnet e.V. - * - * The JavaScript code in this page is free software: you can - * redistribute it and/or modify it under the terms of the GNU - * General Public License (GNU GPL) as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) - * any later version. The code is distributed WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. - * - * As additional permission under GNU GPL version 3 section 7, you - * may distribute non-source (e.g., minimized or compacted) forms of - * that code without the copy of the GNU GPL normally required by - * section 4, provided you include this license notice and a URL - * through which recipients can access the Corresponding Source. - * - * @licend The above is the entire license notice - * for the JavaScript code in this page. - */ - -// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later - -function supports_html5_storage() { - try { - return 'sessionStorage' in window && window['sessionStorage'] !== null; - } catch (e) { - return false; - } -} - -function setLang(l) -{ - document.body.className=l; - document.body.parentNode.setAttribute('lang', l); - - if (supports_html5_storage()) { - sessionStorage.setItem('lang', l); - } - if (l == 'en') document.title = 'GNU Taler - Taxable Anonymous Libre Electronic Reserve'; - if (l == 'de') document.title = 'GNU Taler - Taxierbare Anonyme Liberale Elektronische Reserven'; - if (l == 'fr') document.title = 'GNU Taler - Taxable Anonyme Libre Électronique Réserve'; - if (l == 'it') document.title = 'GNU Taler'; -} - -function get_default_lang() -{ - langs = ['en', 'de', 'fr', 'it']; - - for (var i in navigator.languages) { - for (var j in langs) { - if (navigator.languages[i].indexOf(langs[j]) != -1) { - return langs[j]; - } - } - } - - return 'en'; -} - -function loadLang() -{ - l = 'null'; - if (supports_html5_storage()) { - l = sessionStorage.getItem('lang'); - } - - if (l == 'null') l = get_default_lang(); - setLang(l); -} - -function activate_menu() -{ - b = document.getElementsByClassName("m_" + document.URL.replace(/^.*(\\|\/|\:)/, '').split('.')[0]) - for (i = 0; i < b.length; i++) { - s = b[i].getAttribute('class'); - b[i].setAttribute('class', s + ' active'); - } -} - -// @license-end diff --git a/menu.js b/menu.js @@ -0,0 +1,36 @@ +/** + * @licstart The following is the entire license notice for the + * JavaScript code in this page. + * + * Copyright (C) 2014 GNUnet e.V. + * + * The JavaScript code in this page is free software: you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License (GNU GPL) as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) + * any later version. The code is distributed WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. + * + * As additional permission under GNU GPL version 3 section 7, you + * may distribute non-source (e.g., minimized or compacted) forms of + * that code without the copy of the GNU GPL normally required by + * section 4, provided you include this license notice and a URL + * through which recipients can access the Corresponding Source. + * + * @licend The above is the entire license notice + * for the JavaScript code in this page. + */ + +// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later + +function activate_menu() +{ + b = document.getElementsByClassName("m_" + document.URL.replace(/^.*(\\|\/|\:)/, '').split('.')[0]) + for (i = 0; i < b.length; i++) { + s = b[i].getAttribute('class'); + b[i].setAttribute('class', s + ' active'); + } +} + +// @license-end diff --git a/merchants.html.j2 b/merchants.html.j2 @@ -4,7 +4,7 @@ <meta name="description" content=""> <!--# include file="common/header.{{ _("en") }}.inc" --> </head> - <body class="en" onload="loadLang();"> + <body> <div class="container"> <!--# include file="common/navigation.{{ _("en") }}.inc" --> <!-- Jumbotron --> diff --git a/news.html.j2 b/news.html.j2 @@ -4,7 +4,7 @@ <meta name="description" content=""> <!--# include file="common/header.{{ _("en") }}.inc" --> </head> - <body class="en" onload="loadLang();"> + <body> <div class="container"> <!--# include file="common/navigation.{{ _("en") }}.inc" --> <!-- Jumbotron --> diff --git a/wallet.html.j2 b/wallet.html.j2 @@ -107,7 +107,7 @@ document.addEventListener('DOMContentLoaded', onLoad); </style> </head> - <body class="en" onLoad="loadLang();"> + <body> <div class="container"> <!--# include file="common/navigation.{{ _("en") }}.inc" --> <!-- Jumbotron -->