aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortg(x) <*@tg-x.net>2017-01-19 23:45:29 +0100
committertg(x) <*@tg-x.net>2017-01-19 23:45:29 +0100
commit592850e144e38520fb166ee490c25b0283257d16 (patch)
tree7b4fa37953885be38a117ab31ebdfb95badffcbb
parent5512942ea77aa8a474a0163f8ef3097d678f8675 (diff)
downloadwww-592850e144e38520fb166ee490c25b0283257d16.tar.gz
www-592850e144e38520fb166ee490c25b0283257d16.zip
i18n: fix js, lang switcher
-rw-r--r--about.html.j22
-rw-r--r--citizens.html.j22
-rw-r--r--common/header.inc.j21
-rw-r--r--common/navigation.inc.j210
-rw-r--r--developers.html.j22
-rw-r--r--financial-news.html.j22
-rw-r--r--governments.html.j22
-rw-r--r--index.html.j22
-rw-r--r--investors.html.j22
-rw-r--r--lang.css60
-rw-r--r--menu.js (renamed from lang.js)48
-rw-r--r--merchants.html.j22
-rw-r--r--news.html.j22
-rw-r--r--wallet.html.j22
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 @@
4 <meta name="description" content=""> 4 <meta name="description" content="">
5 <!--# include file="common/header.{{ _("en") }}.inc" --> 5 <!--# include file="common/header.{{ _("en") }}.inc" -->
6 </head> 6 </head>
7 <body class="en" onload="loadLang();"> 7 <body>
8 <div class="container"> 8 <div class="container">
9 <!--# include file="common/navigation.{{ _("en") }}.inc" --> 9 <!--# include file="common/navigation.{{ _("en") }}.inc" -->
10 <!-- Jumbotron --> 10 <!-- 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 @@
4 <meta name="description" content=""> 4 <meta name="description" content="">
5 <!--# include file="common/header.{{ _("en") }}.inc" --> 5 <!--# include file="common/header.{{ _("en") }}.inc" -->
6 </head> 6 </head>
7 <body class="en" onload="loadLang();"> 7 <body>
8 <div class="container"> 8 <div class="container">
9 <!--# include file="common/navigation.{{ _("en") }}.inc" --> 9 <!--# include file="common/navigation.{{ _("en") }}.inc" -->
10 <!-- Jumbotron --> 10 <!-- 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 @@
35 <link href="/justified-nav.css" rel="stylesheet"> 35 <link href="/justified-nav.css" rel="stylesheet">
36 <link href="/styles.css" rel="stylesheet"> 36 <link href="/styles.css" rel="stylesheet">
37 37
38 <script src="/menu.js"></script>
38 <script src="/dist/js/jquery-1.11.1.min.js"></script> 39 <script src="/dist/js/jquery-1.11.1.min.js"></script>
39 <script src="/dist/js/bootstrap.min.js"></script> 40 <script src="/dist/js/bootstrap.min.js"></script>
40 41
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 @@
22 </div> 22 </div>
23 <div class="navbar navbar-default navbar-fixed-bottom" role="navigation"> 23 <div class="navbar navbar-default navbar-fixed-bottom" role="navigation">
24 <div class="container lang-slector"> 24 <div class="container lang-slector">
25 <a href="/en/"><img src="/images/gb.png" height="15" width="23" alt="English"></a> 25 <a href="#" onclick="location.pathname=location.pathname.replace(/^.../, '/en')"><img src="/images/gb.png" height="15" width="23" alt="English"></a>
26 <a href="/de/"><img src="/images/de.png" height="15" width="25" alt="Deutsch"></a> 26 <a href="#" onclick="location.pathname=location.pathname.replace(/^.../, '/de')"><img src="/images/de.png" height="15" width="25" alt="Deutsch"></a>
27 <a href="/fr/"><img src="/images/fr.png" height="15" width="22" alt="Français"></a> 27 <a href="#" onclick="location.pathname=location.pathname.replace(/^.../, '/fr')"><img src="/images/fr.png" height="15" width="22" alt="Français"></a>
28 <a href="/it/"><img src="/images/it.png" height="15" width="22" alt="Italiano"></a> 28 <a href="#" onclick="location.pathname=location.pathname.replace(/^.../, '/it')"><img src="/images/it.png" height="15" width="22" alt="Italiano"></a>
29 <a href="/es/"><img src="/images/es.png" height="15" width="23" alt="Español"></a> 29 <a href="#" onclick="location.pathname=location.pathname.replace(/^.../, '/es')"><img src="/images/es.png" height="15" width="23" alt="Español"></a>
30 </div> 30 </div>
31 </div> 31 </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 @@
4 <meta name="description" content=""> 4 <meta name="description" content="">
5 <!--# include file="common/header.{{ _("en") }}.inc" --> 5 <!--# include file="common/header.{{ _("en") }}.inc" -->
6 </head> 6 </head>
7 <body class="en" onload="loadLang();"> 7 <body>
8 <div class="container"> 8 <div class="container">
9 <!--# include file="common/navigation.{{ _("en") }}.inc" --> 9 <!--# include file="common/navigation.{{ _("en") }}.inc" -->
10 <!-- Jumbotron --> 10 <!-- 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 @@
6 <meta name="description" content=""> 6 <meta name="description" content="">
7 <!--# include file="common/header.{{ _("en") }}.inc" --> 7 <!--# include file="common/header.{{ _("en") }}.inc" -->
8 </head> 8 </head>
9 <body class="en" onLoad="loadLang();"> 9 <body>
10 <div class="container"> 10 <div class="container">
11 <!--# include file="common/navigation.{{ _("en") }}.inc" --> 11 <!--# include file="common/navigation.{{ _("en") }}.inc" -->
12 <!-- Jumbotron --> 12 <!-- 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 @@
4 <meta name="description" content=""> 4 <meta name="description" content="">
5 <!--# include file="common/header.{{ _("en") }}.inc" --> 5 <!--# include file="common/header.{{ _("en") }}.inc" -->
6 </head> 6 </head>
7 <body class="en" onload="loadLang();"> 7 <body>
8 <div class="container"> 8 <div class="container">
9 <!--# include file="common/navigation.{{ _("en") }}.inc" --> 9 <!--# include file="common/navigation.{{ _("en") }}.inc" -->
10 <!-- Jumbotron --> 10 <!-- 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 @@
4 <meta name="description" content="Anonymous electronic payments for civil society"> 4 <meta name="description" content="Anonymous electronic payments for civil society">
5 <!--# include file="common/header.{{ _("en") }}.inc" --> 5 <!--# include file="common/header.{{ _("en") }}.inc" -->
6 </head> 6 </head>
7 <body class="en" onload="loadLang();"> 7 <body>
8 <div class="container"> 8 <div class="container">
9 <!--# include file="common/navigation.{{ _("en") }}.inc" --> 9 <!--# include file="common/navigation.{{ _("en") }}.inc" -->
10 <!-- Jumbotron --> 10 <!-- 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 @@
4 <meta name="description" content=""> 4 <meta name="description" content="">
5 <!--# include file="common/header.{{ _("en") }}.inc" --> 5 <!--# include file="common/header.{{ _("en") }}.inc" -->
6 </head> 6 </head>
7 <body class="en" onload="loadLang();"> 7 <body>
8 <div class="container"> 8 <div class="container">
9 <!--# include file="common/navigation.{{ _("en") }}.inc" --> 9 <!--# include file="common/navigation.{{ _("en") }}.inc" -->
10 <!-- Jumbotron --> 10 <!-- 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 @@
1body.en :lang(de) {
2 display: none;
3}
4body.en :lang(fr) {
5 display: none;
6}
7body.en :lang(it) {
8 display: none;
9}
10body.en :lang(es) {
11 display: none;
12}
13body.de :lang(en) {
14 display: none;
15}
16body.de :lang(fr) {
17 display: none;
18}
19body.de :lang(it) {
20 display: none;
21}
22body.de :lang(es) {
23 display: none;
24}
25body.fr :lang(de) {
26 display: none;
27}
28body.fr :lang(en) {
29 display: none;
30}
31body.fr :lang(it) {
32 display: none;
33}
34body.fr :lang(es) {
35 display: none;
36}
37body.it :lang(de) {
38 display: none;
39}
40body.it :lang(en) {
41 display: none;
42}
43body.it :lang(fr) {
44 display: none;
45}
46body.it :lang(es) {
47 display: none;
48}
49body.es :lang(de) {
50 display: none;
51}
52body.es :lang(en) {
53 display: none;
54}
55body.es :lang(fr) {
56 display: none;
57}
58body.es :lang(it) {
59 display: none;
60}
diff --git a/lang.js b/menu.js
index 24faa9f7..3026dab5 100644
--- a/lang.js
+++ b/menu.js
@@ -24,54 +24,6 @@
24 24
25// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later 25// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later
26 26
27function supports_html5_storage() {
28 try {
29 return 'sessionStorage' in window && window['sessionStorage'] !== null;
30 } catch (e) {
31 return false;
32 }
33}
34
35function setLang(l)
36{
37 document.body.className=l;
38 document.body.parentNode.setAttribute('lang', l);
39
40 if (supports_html5_storage()) {
41 sessionStorage.setItem('lang', l);
42 }
43 if (l == 'en') document.title = 'GNU Taler - Taxable Anonymous Libre Electronic Reserve';
44 if (l == 'de') document.title = 'GNU Taler - Taxierbare Anonyme Liberale Elektronische Reserven';
45 if (l == 'fr') document.title = 'GNU Taler - Taxable Anonyme Libre Électronique Réserve';
46 if (l == 'it') document.title = 'GNU Taler';
47}
48
49function get_default_lang()
50{
51 langs = ['en', 'de', 'fr', 'it'];
52
53 for (var i in navigator.languages) {
54 for (var j in langs) {
55 if (navigator.languages[i].indexOf(langs[j]) != -1) {
56 return langs[j];
57 }
58 }
59 }
60
61 return 'en';
62}
63
64function loadLang()
65{
66 l = 'null';
67 if (supports_html5_storage()) {
68 l = sessionStorage.getItem('lang');
69 }
70
71 if (l == 'null') l = get_default_lang();
72 setLang(l);
73}
74
75function activate_menu() 27function activate_menu()
76{ 28{
77 b = document.getElementsByClassName("m_" + document.URL.replace(/^.*(\\|\/|\:)/, '').split('.')[0]) 29 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 @@
4 <meta name="description" content=""> 4 <meta name="description" content="">
5 <!--# include file="common/header.{{ _("en") }}.inc" --> 5 <!--# include file="common/header.{{ _("en") }}.inc" -->
6 </head> 6 </head>
7 <body class="en" onload="loadLang();"> 7 <body>
8 <div class="container"> 8 <div class="container">
9 <!--# include file="common/navigation.{{ _("en") }}.inc" --> 9 <!--# include file="common/navigation.{{ _("en") }}.inc" -->
10 <!-- Jumbotron --> 10 <!-- 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 @@
4 <meta name="description" content=""> 4 <meta name="description" content="">
5 <!--# include file="common/header.{{ _("en") }}.inc" --> 5 <!--# include file="common/header.{{ _("en") }}.inc" -->
6 </head> 6 </head>
7 <body class="en" onload="loadLang();"> 7 <body>
8 <div class="container"> 8 <div class="container">
9 <!--# include file="common/navigation.{{ _("en") }}.inc" --> 9 <!--# include file="common/navigation.{{ _("en") }}.inc" -->
10 <!-- Jumbotron --> 10 <!-- 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);
107 </style> 107 </style>
108 </head> 108 </head>
109 109
110 <body class="en" onLoad="loadLang();"> 110 <body>
111 <div class="container"> 111 <div class="container">
112 <!--# include file="common/navigation.{{ _("en") }}.inc" --> 112 <!--# include file="common/navigation.{{ _("en") }}.inc" -->
113 <!-- Jumbotron --> 113 <!-- Jumbotron -->