|
1 | 1 | ;(function($) { |
2 | 2 | var populateWindow = function(link) { |
3 | 3 | var markdownRequest = new Request({ |
4 | | - "url": here + 'manual/en-US/' + link, |
| 4 | + "url": here + 'manual/' + locale + '/' + link, |
5 | 5 | "method": "get", |
6 | 6 | "onSuccess": function(response) { |
7 | 7 | $('docwin').set('html', marked(response)); |
|
33 | 33 |
|
34 | 34 | var populateMenu = function() { |
35 | 35 | var markdownRequest = new Request({ |
36 | | - "url": here + 'manual/en-US/menu.md', |
| 36 | + "url": here + 'manual/' + locale + '/menu.md', |
37 | 37 | "method": "get", |
38 | 38 | "onSuccess": function (response) { |
39 | 39 | $('doc-menu').set('html', marked(response)); |
|
55 | 55 |
|
56 | 56 | var populateVersion = function() { |
57 | 57 | var versionRequest = new Request({ |
58 | | - "url": here + 'manual/en-US/version.md', |
| 58 | + "url": here + 'manual/' + locale + '/version.md', |
59 | 59 | "method": "get", |
60 | 60 | "onSuccess": function(response) { |
61 | 61 | $('version').set('html', marked(response)); |
|
67 | 67 | var urlParts = document.URL.split('?', 2); |
68 | 68 | state = {}; |
69 | 69 | here = urlParts[0]; |
| 70 | + locale = 'en-US'; |
70 | 71 |
|
71 | 72 | if (urlParts.length > 1) |
72 | 73 | { |
|
91 | 92 | populateWindow(currentDoc); |
92 | 93 | populateVersion(); |
93 | 94 |
|
| 95 | + document.id('language-item').addEvent('click:relay(a)', function (event, target) { |
| 96 | + locale = target.get('href'); |
| 97 | + populateWindow(currentDoc); |
| 98 | + event.preventDefault(); |
| 99 | + |
| 100 | + // Update display text on dropdown menu |
| 101 | + var currentLang = target.get('html'); |
| 102 | + $('language-select').set('html', currentLang); |
| 103 | + }); |
| 104 | + |
94 | 105 | document.id('main').addEvent('click:relay(a)', function (event, target) { |
95 | 106 | if (target.get('href').substring(0, 4) != 'http' && target.get('href').substring(0, 1) != '#') |
96 | 107 | { |
|
0 commit comments