diff options
author | tg(x) <*@tg-x.net> | 2017-01-19 23:45:29 +0100 |
---|---|---|
committer | tg(x) <*@tg-x.net> | 2017-01-19 23:45:29 +0100 |
commit | 592850e144e38520fb166ee490c25b0283257d16 (patch) | |
tree | 7b4fa37953885be38a117ab31ebdfb95badffcbb | |
parent | 5512942ea77aa8a474a0163f8ef3097d678f8675 (diff) | |
download | www-592850e144e38520fb166ee490c25b0283257d16.tar.gz www-592850e144e38520fb166ee490c25b0283257d16.tar.bz2 www-592850e144e38520fb166ee490c25b0283257d16.zip |
i18n: fix js, lang switcher
-rw-r--r-- | about.html.j2 | 2 | ||||
-rw-r--r-- | citizens.html.j2 | 2 | ||||
-rw-r--r-- | common/header.inc.j2 | 1 | ||||
-rw-r--r-- | common/navigation.inc.j2 | 10 | ||||
-rw-r--r-- | developers.html.j2 | 2 | ||||
-rw-r--r-- | financial-news.html.j2 | 2 | ||||
-rw-r--r-- | governments.html.j2 | 2 | ||||
-rw-r--r-- | index.html.j2 | 2 | ||||
-rw-r--r-- | investors.html.j2 | 2 | ||||
-rw-r--r-- | lang.css | 60 | ||||
-rw-r--r-- | menu.js (renamed from lang.js) | 48 | ||||
-rw-r--r-- | merchants.html.j2 | 2 | ||||
-rw-r--r-- | news.html.j2 | 2 | ||||
-rw-r--r-- | wallet.html.j2 | 2 |
14 files changed, 16 insertions, 123 deletions
diff --git a/about.html.j2 b/about.html.j2 index 7880cf65..335d213b 100644 --- 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 index d6256274..77212e94 100644 --- 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 index 4115aafa..b71482d9 100644 --- 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 index 7b421464..90c328a5 100644 --- 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 index 0225ef75..02e6beae 100644 --- 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 index b85d7fdb..e424db87 100644 --- 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 index 79af28e1..83f244c6 100644 --- 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 index c012ae5a..5f95a3c7 100644 --- 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 index a87070e9..1dffdb89 100644 --- 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 deleted file mode 100644 index 72b5a2c6..00000000 --- a/lang.css +++ /dev/null @@ -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; -} @@ -24,54 +24,6 @@ // @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]) diff --git a/merchants.html.j2 b/merchants.html.j2 index f5fbd09c..f1ed4e34 100644 --- 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 index f3ea6b23..54dc6f40 100644 --- 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 index 7b4914a2..7045e64a 100644 --- 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 --> |