Add language selector in static pages' footer
This commit is contained in:
parent
5887ff1a6d
commit
ff17a0aad6
@ -1,10 +1,11 @@
|
|||||||
define([
|
define([
|
||||||
'/api/config',
|
'/api/config',
|
||||||
'/common/hyperscript.js',
|
'/common/hyperscript.js',
|
||||||
|
'/common/common-language.js',
|
||||||
'/customize/messages.js',
|
'/customize/messages.js',
|
||||||
'jquery',
|
'jquery',
|
||||||
'/customize/application_config.js',
|
'/customize/application_config.js',
|
||||||
], function (Config, h, Msg, $, AppConfig) {
|
], function (Config, h, Language, Msg, $, AppConfig) {
|
||||||
var Pages = {};
|
var Pages = {};
|
||||||
var urlArgs = Config.requireConf.urlArgs;
|
var urlArgs = Config.requireConf.urlArgs;
|
||||||
|
|
||||||
@ -13,6 +14,25 @@ define([
|
|||||||
return e;
|
return e;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var languageSelector = function () {
|
||||||
|
var options = [];
|
||||||
|
var languages = Msg._languages;
|
||||||
|
var selected = Msg._languageUsed;
|
||||||
|
var keys = Object.keys(languages).sort();
|
||||||
|
keys.forEach(function (l) {
|
||||||
|
var attr = { value: l };
|
||||||
|
if (selected === l) { attr.selected = 'selected'; }
|
||||||
|
options.push(h('option', attr, languages[l]));
|
||||||
|
});
|
||||||
|
var select = h('select', {}, options);
|
||||||
|
$(select).change(function () {
|
||||||
|
Language.setLanguage($(select).val() || '', null, function () {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return select;
|
||||||
|
};
|
||||||
|
|
||||||
var footerCol = function (title, L, literal) {
|
var footerCol = function (title, L, literal) {
|
||||||
return h('div.col-6.col-sm-3', [
|
return h('div.col-6.col-sm-3', [
|
||||||
h('ul.list-unstyled', [
|
h('ul.list-unstyled', [
|
||||||
@ -47,7 +67,8 @@ define([
|
|||||||
h('div.row', [
|
h('div.row', [
|
||||||
footerCol(null, [
|
footerCol(null, [
|
||||||
h('div.cp-bio-foot', [
|
h('div.cp-bio-foot', [
|
||||||
h('p', Msg.main_footerText)
|
h('p', Msg.main_footerText),
|
||||||
|
languageSelector()
|
||||||
])
|
])
|
||||||
], ''),
|
], ''),
|
||||||
footerCol('footer_applications', [
|
footerCol('footer_applications', [
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user