Commit c3df148f authored by Dietmar Maurer's avatar Dietmar Maurer

implement language selector

we can now set the language in the datacenter config file,
but the value is not used (we still have no i18n)
parent 8d20a4ba
......@@ -32,6 +32,7 @@ JSSRC= \
form/BridgeSelector.js \
form/CPUModelSelector.js \
form/VNCKeyboardSelector.js \
form/LanguageSelector.js \
form/DisplaySelector.js \
form/CacheTypeSelector.js \
form/ContentTypeSelector.js \
......
......@@ -175,6 +175,31 @@ Ext.define('PVE.Utils', { statics: {
return data;
},
language_map: {
en: 'English',
de: 'German'
},
render_language: function (value) {
if (!value) {
return 'Default (English)';
}
var text = PVE.Utils.language_map[value];
if (text) {
return text + ' (' + value + ')';
}
return value;
},
language_array: function() {
var data = [['', PVE.Utils.render_language('')]];
Ext.Object.each(PVE.Utils.language_map, function(key, value) {
data.push([key, PVE.Utils.render_language(value)]);
});
return data;
},
render_kvm_vga_driver: function (value) {
if (!value) {
return 'Default';
......
Ext.define('PVE.dc.LanguageEdit', {
extend: 'PVE.window.Edit',
initComponent : function() {
var me = this;
Ext.applyIf(me, {
title: "Edit language settings",
items: {
xtype: 'pveLanguageSelector',
name: 'language',
value: '',
fieldLabel: 'Language'
}
});
me.callParent();
me.load();
}
});
Ext.define('PVE.dc.KeyboardEdit', {
extend: 'PVE.window.Edit',
......@@ -40,6 +62,8 @@ Ext.define('PVE.dc.OptionView', {
},
language: {
header: 'GUI language',
editor: 'PVE.dc.LanguageEdit',
renderer: PVE.Utils.render_language,
required: true
},
http_proxy: {
......
Ext.define('PVE.form.LanguageSelector', {
extend: 'PVE.form.KVComboBox',
alias: ['widget.pveLanguageSelector'],
initComponent: function() {
var me = this;
me.data = PVE.Utils.language_array();
me.callParent();
}
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment