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)
This commit is contained in:
parent
8d20a4ba6a
commit
c3df148fca
@ -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';
|
||||
|
@ -1,3 +1,25 @@
|
||||
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: {
|
||||
|
10
www/manager/form/LanguageSelector.js
Normal file
10
www/manager/form/LanguageSelector.js
Normal file
@ -0,0 +1,10 @@
|
||||
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();
|
||||
}
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user