|
9 | 9 | <script src="https://unpkg.com/i18next@8.0.0/i18next.min.js"></script> |
10 | 10 | <script src="https://unpkg.com/i18next-browser-languagedetector@1.0.1/i18nextBrowserLanguageDetector.min.js"></script> |
11 | 11 | <script src="https://unpkg.com/i18next-xhr-backend@1.4.1/i18nextXHRBackend.min.js"></script> |
12 | | -<script type="application/javascript" |
13 | | - src="ideologies.js"> |
14 | | -</script> |
| 12 | +<script type="application/javascript" src="ideologies.js"></script> |
| 13 | +<script type="application/javascript" src="i18n.js"></script> |
15 | 14 |
|
16 | 15 | <body> |
17 | 16 | <h1>8values</h1> |
18 | 17 | <hr> |
19 | 18 |
|
20 | | -<h1 id="results" class="translate"></h1> |
| 19 | +<h1 data-i18n="results"></h1> |
21 | 20 |
|
22 | | -<h2><span id="economic_axis" class="translate"></span><span class="weight-300" id="economic-label"></span></h2> |
| 21 | +<h2><span data-i18n="economic_axis"></span><span class="weight-300" id="economic-label"></span></h2> |
23 | 22 | <div class="axis"> |
24 | 23 | <img id="img-equality" src="value_images/equality.svg" height="128pt"/> |
25 | 24 | <div class="bar equality" id="bar-equality"><div class="text-wrapper" id="equality"></div></div> |
26 | 25 | <div class="bar wealth" id="bar-wealth"><div class="text-wrapper" id="wealth"></div></div> |
27 | 26 | <img id="img-wealth" src="value_images/wealth.svg" height="128pt"/> |
28 | 27 | </div> |
29 | | -<h2><span id="diplomatic_axis" class="translate"></span><span class="weight-300" id="diplomatic-label"></span></h2> |
| 28 | +<h2><span data-i18n="diplomatic_axis"></span><span class="weight-300" id="diplomatic-label"></span></h2> |
30 | 29 | <div class="axis"> |
31 | 30 | <img id="img-might" src="value_images/might.svg" height="128pt"/> |
32 | 31 | <div class="bar might" id="bar-might"><div class="text-wrapper" id="might"></div></div> |
33 | 32 | <div class="bar peace" id="bar-peace"><div class="text-wrapper" id="peace"></div></div> |
34 | 33 | <img id="img-peace" src="value_images/peace.svg" height="128pt"/> |
35 | 34 | </div> |
36 | | -<h2><span id="civic_axis" class="translate"></span><span class="weight-300" id="state-label"></span></h2> |
| 35 | +<h2><span data-i18n="civic_axis"></span><span class="weight-300" id="state-label"></span></h2> |
37 | 36 | <div class="axis"> |
38 | 37 | <img id="img-liberty" src="value_images/liberty.svg" height="128pt"/> |
39 | 38 | <div class="bar liberty" id="bar-liberty"><div class="text-wrapper" id="liberty"></div></div> |
40 | 39 | <div class="bar authority" id="bar-authority"><div class="text-wrapper" id="authority"></div></div> |
41 | 40 | <img id="img-authority" src="value_images/authority.svg" height="128pt"/> |
42 | 41 | </div> |
43 | | -<h2><span id="societal_axis" class="translate"></span><span class="weight-300" id="society-label"></span></h2> |
| 42 | +<h2><span data-i18n="societal_axis"></span><span class="weight-300" id="society-label"></span></h2> |
44 | 43 | <div class="axis"> |
45 | 44 | <img id="img-tradition" src="value_images/tradition.svg" height="128pt"/> |
46 | 45 | <div class="bar tradition" id="bar-tradition"><div class="text-wrapper" id="tradition"></div></div> |
47 | 46 | <div class="bar progress" id="bar-progress"><div class="text-wrapper" id="progress"></div></div> |
48 | 47 | <img id="img-progress" src="value_images/progress.svg" height="128pt"/> |
49 | 48 | </div> |
50 | | -<h2><span id="closest_match" class="translate"></span><span class="weight-300" id="ideology-label"></span></h2> |
51 | | -<p id="match_desc" class="translate"></p> |
| 49 | +<h2><span data-i18n="closest_match"></span><span class="weight-300" id="ideology-label"></span></h2> |
| 50 | +<p data-i18n="match_desc"></p> |
52 | 51 | <hr/> |
53 | 52 | <canvas id="banner" width=800 height=600 style="font-family:Montserrat"></canvas> |
54 | | -<button id="back" class="button translate" onclick="location.href='index.html';" style="background-color: #2196f3;"></button> <br> |
| 53 | +<button data-i18n="back" class="button" onclick="location.href='index.html';" style="background-color: #2196f3;"></button> <br> |
55 | 54 | <script> |
56 | 55 | function getQueryVariable(variable) |
57 | 56 | { |
@@ -127,20 +126,10 @@ <h2><span id="closest_match" class="translate"></span><span class="weight-300" i |
127 | 126 | } |
128 | 127 |
|
129 | 128 | window.onload = function() { |
130 | | - window.i18next |
131 | | - .use(window.i18nextBrowserLanguageDetector) |
132 | | - .use(window.i18nextXHRBackend) |
133 | | - .init({ |
134 | | - "fallbackLng": "en", |
135 | | - "ns": [ "ideologies", "matches", "translation" ] |
136 | | - }, ready) |
| 129 | + i18n_load_ns([ "ideologies", "matches", "translation" ], ready) |
137 | 130 | } |
138 | 131 |
|
139 | 132 | function ready() { |
140 | | - for (i of document.getElementsByClassName("translate")) { |
141 | | - document.getElementById(i.id).innerHTML=i18next.t(i.id) |
142 | | - } |
143 | | - |
144 | 133 | ideo_t = i18next.getFixedT(null, "ideologies") |
145 | 134 | mat_t = i18next.getFixedT(null, "matches") |
146 | 135 |
|
|
0 commit comments