LanguageSelector.js - add language selector

This commit is contained in:
Dietmar Maurer 2017-10-04 10:50:59 +02:00
parent 8f5a1a0847
commit f6f0066aff
3 changed files with 35 additions and 0 deletions

View File

@ -27,6 +27,7 @@ JSSRC= \
form/DateTimeField.js \
form/Checkbox.js \
form/KVComboBox.js \
form/LanguageSelector.js \
form/ComboGrid.js \
form/RRDTypeSelector.js \
button/Button.js \

View File

@ -60,6 +60,34 @@ Ext.define('Proxmox.Utils', { utilities: {
stateText: gettext('State'),
groupText: gettext('Group'),
language_map: {
en: 'English',
fr: 'French',
de: 'German',
it: 'Italian',
es: 'Spanish'
},
render_language: function (value) {
if (!value) {
return Proxmox.Utils.defaultText + ' (English)';
}
var text = Proxmox.Utils.language_map[value];
if (text) {
return text + ' (' + value + ')';
}
return value;
},
language_array: function() {
var data = [['__default__', Proxmox.Utils.render_language('')]];
Ext.Object.each(Proxmox.Utils.language_map, function(key, value) {
data.push([key, Proxmox.Utils.render_language(value)]);
});
return data;
},
getNoSubKeyHtml: function(url) {
// url http://www.proxmox.com/products/proxmox-ve/subscription-service-plans
return Ext.String.format('You do not have a valid subscription for this server. Please visit <a target="_blank" href="{0}">www.proxmox.com</a> to get a list of available options.', url || 'http://www.proxmox.com');

6
form/LanguageSelector.js Normal file
View File

@ -0,0 +1,6 @@
Ext.define('Proxmox.form.LanguageSelector', {
extend: 'Proxmox.form.KVComboBox',
xtype: 'proxmoxLanguageSelector',
comboItems: Proxmox.Utils.language_array()
});