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.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 @@ | |||
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 @@ | |||
1 | body.en :lang(de) { | ||
2 | display: none; | ||
3 | } | ||
4 | body.en :lang(fr) { | ||
5 | display: none; | ||
6 | } | ||
7 | body.en :lang(it) { | ||
8 | display: none; | ||
9 | } | ||
10 | body.en :lang(es) { | ||
11 | display: none; | ||
12 | } | ||
13 | body.de :lang(en) { | ||
14 | display: none; | ||
15 | } | ||
16 | body.de :lang(fr) { | ||
17 | display: none; | ||
18 | } | ||
19 | body.de :lang(it) { | ||
20 | display: none; | ||
21 | } | ||
22 | body.de :lang(es) { | ||
23 | display: none; | ||
24 | } | ||
25 | body.fr :lang(de) { | ||
26 | display: none; | ||
27 | } | ||
28 | body.fr :lang(en) { | ||
29 | display: none; | ||
30 | } | ||
31 | body.fr :lang(it) { | ||
32 | display: none; | ||
33 | } | ||
34 | body.fr :lang(es) { | ||
35 | display: none; | ||
36 | } | ||
37 | body.it :lang(de) { | ||
38 | display: none; | ||
39 | } | ||
40 | body.it :lang(en) { | ||
41 | display: none; | ||
42 | } | ||
43 | body.it :lang(fr) { | ||
44 | display: none; | ||
45 | } | ||
46 | body.it :lang(es) { | ||
47 | display: none; | ||
48 | } | ||
49 | body.es :lang(de) { | ||
50 | display: none; | ||
51 | } | ||
52 | body.es :lang(en) { | ||
53 | display: none; | ||
54 | } | ||
55 | body.es :lang(fr) { | ||
56 | display: none; | ||
57 | } | ||
58 | body.es :lang(it) { | ||
59 | display: none; | ||
60 | } | ||
@@ -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 | ||
27 | function supports_html5_storage() { | ||
28 | try { | ||
29 | return 'sessionStorage' in window && window['sessionStorage'] !== null; | ||
30 | } catch (e) { | ||
31 | return false; | ||
32 | } | ||
33 | } | ||
34 | |||
35 | function 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 | |||
49 | function 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 | |||
64 | function 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 | |||
75 | function activate_menu() | 27 | function 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 --> |