mark translateable strings with gettext

This commit is contained in:
Dietmar Maurer 2011-11-22 09:18:56 +01:00
parent 6b96e83ec9
commit a2dca26b09
19 changed files with 176 additions and 167 deletions

View File

@ -30,39 +30,39 @@ Ext.apply(Ext.form.field.VTypes, {
IPAddress: function(v) { IPAddress: function(v) {
return (/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/).test(v); return (/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/).test(v);
}, },
IPAddressText: 'Must be a numeric IP address', IPAddressText: gettext('Example') + ': 192.168.1.1',
IPAddressMask: /[\d\.]/i, IPAddressMask: /[\d\.]/i,
MacAddress: function(v) { MacAddress: function(v) {
return (/^([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}$/).test(v); return (/^([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}$/).test(v);
}, },
MacAddressMask: /[a-fA-F0-9:]/, MacAddressMask: /[a-fA-F0-9:]/,
MacAddressText: 'Must be a valid MAC address (example: "01:23:45:67:89:ab")', MacAddressText: gettext('Example') + ': 01:23:45:67:89:ab',
BridgeName: function(v) { BridgeName: function(v) {
return (/^vmbr\d{1,4}$/).test(v); return (/^vmbr\d{1,4}$/).test(v);
}, },
BridgeNameText: 'Allowable bridge names: vmbr<b>N</b>, where 0 <= <b>N</b> <= 9999', BridgeNameText: gettext('Format') + ': vmbr<b>N</b>, where 0 <= <b>N</b> <= 9999',
BondName: function(v) { BondName: function(v) {
return (/^bond\d{1,4}$/).test(v); return (/^bond\d{1,4}$/).test(v);
}, },
BondNameText: 'Allowable bond names: bond<b>N</b>, where 0 <= <b>N</b> <= 9999', BondNameText: gettext('Format') + ': bond<b>N</b>, where 0 <= <b>N</b> <= 9999',
QemuStartDate: function(v) { QemuStartDate: function(v) {
return (/^(now|\d{4}-\d{1,2}-\d{1,2}(T\d{1,2}:\d{1,2}:\d{1,2})?)$/).test(v); return (/^(now|\d{4}-\d{1,2}-\d{1,2}(T\d{1,2}:\d{1,2}:\d{1,2})?)$/).test(v);
}, },
QemuStartDateText: 'Valid format for date are: "now" or "2006-06-17T16:01:21" or "2006-06-17"', QemuStartDateText: gettext('Format') + ': "now" or "2006-06-17T16:01:21" or "2006-06-17"',
StorageId: function(v) { StorageId: function(v) {
return (/^[a-z][a-z0-9\-\_\.]*[a-z0-9]$/i).test(v); return (/^[a-z][a-z0-9\-\_\.]*[a-z0-9]$/i).test(v);
}, },
StorageIdText: "ID contains illegal characters (allowed characters: 'a-z', '0-9', '-', '_' and '.')", StorageIdText: gettext("Allowed characters") + ": 'a-z', '0-9', '-', '_', '.'",
HttpProxy: function(v) { HttpProxy: function(v) {
return (/^http:\/\/.*$/).test(v); return (/^http:\/\/.*$/).test(v);
}, },
HttpProxyText: "Must confirm to schema 'http://.*' (example: 'http://username:password@host:port/')" HttpProxyText: gettext('Example') + ": http://username:password&#64;host:port/"
}); });
// we dont want that a displayfield set the form dirty flag! // we dont want that a displayfield set the form dirty flag!
@ -244,10 +244,10 @@ Ext.define('PVE.Utils', { statics: {
}, },
extractRequestError: function(result, verbose) { extractRequestError: function(result, verbose) {
var msg = 'Successful'; var msg = gettext('Successful');
if (!result.success) { if (!result.success) {
msg = "Unknown error"; msg = gettext("Unknown error");
if (result.message) { if (result.message) {
msg = result.message; msg = result.message;
if (result.status) { if (result.status) {
@ -270,10 +270,10 @@ Ext.define('PVE.Utils', { statics: {
var msg; var msg;
switch (action.failureType) { switch (action.failureType) {
case Ext.form.action.Action.CLIENT_INVALID: case Ext.form.action.Action.CLIENT_INVALID:
msg = 'Form fields may not be submitted with invalid values'; msg = gettext('Form fields may not be submitted with invalid values');
break; break;
case Ext.form.action.Action.CONNECT_FAILURE: case Ext.form.action.Action.CONNECT_FAILURE:
msg = 'Connect failure'; msg = gettext('Connection error');
var resp = action.response; var resp = action.response;
if (resp.status && resp.statusText) { if (resp.status && resp.statusText) {
msg += " " + resp.status + ": " + resp.statusText; msg += " " + resp.status + ": " + resp.statusText;
@ -291,7 +291,7 @@ Ext.define('PVE.Utils', { statics: {
API2Request: function(reqOpts) { API2Request: function(reqOpts) {
var newopts = Ext.apply({ var newopts = Ext.apply({
waitMsg: 'Please wait...' waitMsg: gettext('Please wait...')
}, reqOpts); }, reqOpts);
if (!newopts.url.match(/^\/api2/)) { if (!newopts.url.match(/^\/api2/)) {
@ -324,13 +324,13 @@ Ext.define('PVE.Utils', { statics: {
try { try {
response.result = Ext.decode(response.responseText); response.result = Ext.decode(response.responseText);
} catch(e) {} } catch(e) {}
var msg = "Connection error - server offline?"; var msg = gettext('Connection error') + ' - server offline?';
if (response.aborted) { if (response.aborted) {
msg = 'Transaction aborted.'; msg = gettext('Connection error') + ' - aborted.';
} else if (response.timedout) { } else if (response.timedout) {
msg = 'Communication failure: Timeout.'; msg = gettext('Connection error') + ' - Timeout.';
} else if (response.status && response.statusText) { } else if (response.status && response.statusText) {
msg = 'Connection error ' + response.status + ': ' + response.statusText; msg = gettext('Connection error') + ' ' + response.status + ': ' + response.statusText;
} }
response.htmlStatus = msg; response.htmlStatus = msg;
Ext.callback(callbackFn, options.scope, [options, false, response]); Ext.callback(callbackFn, options.scope, [options, false, response]);
@ -541,19 +541,23 @@ Ext.define('PVE.Utils', { statics: {
} }
}, },
yesText: gettext('Yes'),
noText: gettext('No'),
defaultText: gettext('Default'),
format_boolean_with_default: function(value) { format_boolean_with_default: function(value) {
if (Ext.isDefined(value) && value !== '') { if (Ext.isDefined(value) && value !== '') {
return value ? 'Yes' : 'No'; return value ? PVE.Utils.yesText : PVE.Utils.noText;
} }
return 'Default'; return PVE.Utils.defaultText;
}, },
format_boolean: function(value) { format_boolean: function(value) {
return value ? 'Yes' : 'No'; return value ? PVE.Utils.yesText : PVE.Utils.noText;
}, },
format_neg_boolean: function(value) { format_neg_boolean: function(value) {
return !value ? 'Yes' : 'No'; return !value ? PVE.Utils.yesText : PVE.Utils.noText;
}, },
format_content_types: function(value) { format_content_types: function(value) {

View File

@ -228,16 +228,16 @@ Ext.define('PVE.KVMConsole', {
var tbar = [ var tbar = [
{ {
text: 'Start', text: gettext('Start'),
handler: function() { handler: function() {
vm_command("start", {}, 1); vm_command("start", {}, 1);
} }
}, },
{ {
text: 'Stop', text: gettext('Stop'),
handler: function() { handler: function() {
var msg = "Do you really want to stop the VM?"; var msg = Ext.String.format(gettext("Do you really want to stop VM {0}?"), me.vmid);
Ext.Msg.confirm('Confirm', msg, function(btn) { Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
if (btn !== 'yes') { if (btn !== 'yes') {
return; return;
} }
@ -251,10 +251,10 @@ Ext.define('PVE.KVMConsole', {
vmid: me.vmid vmid: me.vmid
}, },
{ {
text: 'Reset', text: gettext('Reset'),
handler: function() { handler: function() {
var msg = "Do you really want to reset the VM?"; var msg = Ext.String.format(gettext("Do you really want to reset VM {0}?"), me.vmid);
Ext.Msg.confirm('Confirm', msg, function(btn) { Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
if (btn !== 'yes') { if (btn !== 'yes') {
return; return;
} }
@ -263,10 +263,10 @@ Ext.define('PVE.KVMConsole', {
} }
}, },
{ {
text: 'Shutdown', text: gettext('Shutdown'),
handler: function() { handler: function() {
var msg = "Do you really want to shutdown the VM?"; var msg = Ext.String.format(gettext("Do you really want to shutdown VM {0}?"), me.vmid);
Ext.Msg.confirm('Confirm', msg, function(btn) { Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
if (btn !== 'yes') { if (btn !== 'yes') {
return; return;
} }
@ -275,10 +275,10 @@ Ext.define('PVE.KVMConsole', {
} }
}, },
{ {
text: 'Suspend', text: gettext('Suspend'),
handler: function() { handler: function() {
var msg = "Do you really want to suspend the VM?"; var msg = Ext.String.format(gettext("Do you really want to suspend VM {0}?"), me.vmid);
Ext.Msg.confirm('Confirm', msg, function(btn) { Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
if (btn !== 'yes') { if (btn !== 'yes') {
return; return;
} }
@ -287,27 +287,27 @@ Ext.define('PVE.KVMConsole', {
} }
}, },
{ {
text: 'Resume', text: gettext('Resume'),
handler: function() { handler: function() {
vm_command("resume"); vm_command("resume");
} }
}, },
'->', '->',
{ {
text: 'Refresh', text: gettext('Refresh'),
handler: function() { handler: function() {
var applet = Ext.getDom(me.appletID); var applet = Ext.getDom(me.appletID);
applet.sendRefreshRequest(); applet.sendRefreshRequest();
} }
}, },
{ {
text: 'Reload', text: gettext('Reload'),
handler: function () { handler: function () {
me.reloadApplet(); me.reloadApplet();
} }
}, },
{ {
text: 'Console', text: gettext('Console'),
handler: function() { handler: function() {
var url = Ext.urlEncode({ var url = Ext.urlEncode({
console: 'kvm', console: 'kvm',
@ -364,16 +364,16 @@ Ext.define('PVE.OpenVZConsole', {
var tbar = [ var tbar = [
{ {
text: 'Start', text: gettext('Start'),
handler: function() { handler: function() {
vm_command("start", {}, 1); vm_command("start", {}, 1);
} }
}, },
{ {
text: 'Stop', text: gettext('Stop'),
handler: function() { handler: function() {
var msg = "Do you really want to stop the VM?"; var msg = Ext.String.format(gettext("Do you really want to stop VM {0}?"), me.vmid);
Ext.Msg.confirm('Confirm', msg, function(btn) { Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
if (btn !== 'yes') { if (btn !== 'yes') {
return; return;
} }
@ -382,10 +382,10 @@ Ext.define('PVE.OpenVZConsole', {
} }
}, },
{ {
text: 'Shutdown', text: gettext('Shutdown'),
handler: function() { handler: function() {
var msg = "Do you really want to shutdown the VM?"; var msg = Ext.String.format(gettext("Do you really want to shutdown VM {0}?"), me.vmid);
Ext.Msg.confirm('Confirm', msg, function(btn) { Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
if (btn !== 'yes') { if (btn !== 'yes') {
return; return;
} }
@ -395,20 +395,20 @@ Ext.define('PVE.OpenVZConsole', {
}, },
'->', '->',
{ {
text: 'Refresh', text: gettext('Refresh'),
handler: function() { handler: function() {
var applet = Ext.getDom(me.appletID); var applet = Ext.getDom(me.appletID);
applet.sendRefreshRequest(); applet.sendRefreshRequest();
} }
}, },
{ {
text: 'Reload', text: gettext('Reload'),
handler: function () { handler: function () {
me.reloadApplet(); me.reloadApplet();
} }
}, },
{ {
text: 'Console', text: gettext('Console'),
handler: function() { handler: function() {
var url = Ext.urlEncode({ var url = Ext.urlEncode({
console: 'openvz', console: 'openvz',
@ -445,18 +445,18 @@ Ext.define('PVE.Shell', {
var tbar = [ var tbar = [
'->', '->',
{ {
text: 'Refresh', text: gettext('Refresh'),
handler: function() { handler: function() {
var applet = Ext.getDom(me.appletID); var applet = Ext.getDom(me.appletID);
applet.sendRefreshRequest(); applet.sendRefreshRequest();
} }
}, },
{ {
text: 'Reload', text: gettext('Reload'),
handler: function () { me.reloadApplet(); } handler: function () { me.reloadApplet(); }
}, },
{ {
text: 'Shell', text: gettext('Shell'),
handler: function() { handler: function() {
var url = Ext.urlEncode({ var url = Ext.urlEncode({
console: 'shell', console: 'shell',

View File

@ -208,7 +208,8 @@ Ext.define('PVE.StdWorkspace', {
var ui = me.query('#userinfo')[0]; var ui = me.query('#userinfo')[0];
if (PVE.UserName) { if (PVE.UserName) {
ui.update('<div class="x-unselectable" style="white-space:nowrap;">You are logged in as "' + PVE.UserName + '"</div>'); var msg = Ext.String.format(gettext("You are logged in as {0}"), "'" + PVE.UserName + "'");
ui.update('<div class="x-unselectable" style="white-space:nowrap;">' + msg + '</div>');
} else { } else {
ui.update(''); ui.update('');
} }
@ -304,7 +305,7 @@ Ext.define('PVE.StdWorkspace', {
margins: '3 5 0 0', margins: '3 5 0 0',
xtype: 'button', xtype: 'button',
baseCls: 'x-btn', baseCls: 'x-btn',
text: "Logout", text: gettext("Logout"),
handler: function() { handler: function() {
PVE.data.ResourceStore.stopUpdate(); PVE.data.ResourceStore.stopUpdate();
me.showLogin(); me.showLogin();
@ -318,7 +319,7 @@ Ext.define('PVE.StdWorkspace', {
margins: '3 5 0 0', margins: '3 5 0 0',
xtype: 'button', xtype: 'button',
baseCls: 'x-btn', baseCls: 'x-btn',
text: "Create VM", text: gettext("Create VM"),
handler: function() { handler: function() {
var wiz = Ext.create('PVE.qemu.CreateWizard', {}); var wiz = Ext.create('PVE.qemu.CreateWizard', {});
wiz.show(); wiz.show();
@ -329,7 +330,7 @@ Ext.define('PVE.StdWorkspace', {
margins: '3 5 0 0', margins: '3 5 0 0',
xtype: 'button', xtype: 'button',
baseCls: 'x-btn', baseCls: 'x-btn',
text: "Create CT", text: gettext("Create CT"),
handler: function() { handler: function() {
var wiz = Ext.create('PVE.openvz.CreateWizard', {}); var wiz = Ext.create('PVE.openvz.CreateWizard', {});
wiz.show(); wiz.show();

View File

@ -37,7 +37,7 @@ Ext.define('PVE.button.Button', {
if (Ext.isFunction(me.confirmMsg)) { if (Ext.isFunction(me.confirmMsg)) {
msg = me.confirmMsg(rec); msg = me.confirmMsg(rec);
} }
Ext.Msg.confirm('Confirmation', msg, function(btn) { Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
if (btn !== 'yes') { if (btn !== 'yes') {
return; return;
} }

View File

@ -6,47 +6,47 @@ Ext.define('PVE.dc.Config', {
var me = this; var me = this;
Ext.apply(me, { Ext.apply(me, {
title: "Datacenter", title: gettext("Datacenter"),
hstateid: 'dctab', hstateid: 'dctab',
items: [ items: [
{ {
xtype: 'pveDcOptionView', xtype: 'pveDcOptionView',
title: 'Options', title: gettext('Options'),
itemId: 'options' itemId: 'options'
}, },
{ {
xtype: 'pveStorageView', xtype: 'pveStorageView',
title: 'Storage', title: gettext('Storage'),
itemId: 'storage' itemId: 'storage'
}, },
{ {
xtype: 'pveDcBackupView', xtype: 'pveDcBackupView',
title: 'Backup', title: gettext('Backup'),
itemId: 'backup' itemId: 'backup'
}, },
{ {
xtype: 'pveUserView', xtype: 'pveUserView',
title: 'Users', title: gettext('Users'),
itemId: 'users' itemId: 'users'
}, },
{ {
xtype: 'pveGroupView', xtype: 'pveGroupView',
title: 'Groups', title: gettext('Groups'),
itemId: 'groups' itemId: 'groups'
}, },
{ {
xtype: 'pveACLView', xtype: 'pveACLView',
title: 'Permissions', title: gettext('Permissions'),
itemId: 'permissions' itemId: 'permissions'
}, },
{ {
xtype: 'pveRoleView', xtype: 'pveRoleView',
title: 'Roles', title: gettext('Roles'),
itemId: 'roles' itemId: 'roles'
}, },
{ {
xtype: 'pveAuthView', xtype: 'pveAuthView',
title: 'Authentication', title: gettext('Authentication'),
itemId: 'domains' itemId: 'domains'
} }
] ]

View File

@ -39,7 +39,7 @@ Ext.define('PVE.dc.Log', {
sortableColumns: false, sortableColumns: false,
columns: [ columns: [
{ {
header: "Start Time", header: gettext("Time"),
dataIndex: 'time', dataIndex: 'time',
width: 100, width: 100,
renderer: function(value) { renderer: function(value) {
@ -47,12 +47,12 @@ Ext.define('PVE.dc.Log', {
} }
}, },
{ {
header: "Node", header: gettext("Node"),
dataIndex: 'node', dataIndex: 'node',
width: 100 width: 100
}, },
{ {
header: "Tag", header: gettext("Service"),
dataIndex: 'tag', dataIndex: 'tag',
width: 100 width: 100
}, },
@ -62,18 +62,18 @@ Ext.define('PVE.dc.Log', {
width: 100 width: 100
}, },
{ {
header: "User", header: gettext("User name"),
dataIndex: 'user', dataIndex: 'user',
width: 150 width: 150
}, },
{ {
header: "Severity", header: gettext("Severity"),
dataIndex: 'pri', dataIndex: 'pri',
renderer: PVE.Utils.render_serverity, renderer: PVE.Utils.render_serverity,
width: 100 width: 100
}, },
{ {
header: "Message", header: gettext("Message"),
dataIndex: 'msg', dataIndex: 'msg',
flex: 1 flex: 1
} }

View File

@ -58,7 +58,7 @@ Ext.define('PVE.dc.Tasks', {
sortableColumns: false, sortableColumns: false,
columns: [ columns: [
{ {
header: "Start Time", header: gettext("Start Time"),
dataIndex: 'starttime', dataIndex: 'starttime',
width: 100, width: 100,
renderer: function(value) { renderer: function(value) {
@ -66,7 +66,7 @@ Ext.define('PVE.dc.Tasks', {
} }
}, },
{ {
header: "End Time", header: gettext("End Time"),
dataIndex: 'endtime', dataIndex: 'endtime',
width: 100, width: 100,
renderer: function(value, metaData, record) { renderer: function(value, metaData, record) {
@ -78,23 +78,23 @@ Ext.define('PVE.dc.Tasks', {
} }
}, },
{ {
header: "Node", header: gettext("Node"),
dataIndex: 'node', dataIndex: 'node',
width: 100 width: 100
}, },
{ {
header: "User", header: gettext("User name"),
dataIndex: 'user', dataIndex: 'user',
width: 150 width: 150
}, },
{ {
header: "Description", header: gettext("Description"),
dataIndex: 'upid', dataIndex: 'upid',
flex: 1, flex: 1,
renderer: PVE.Utils.render_upid renderer: PVE.Utils.render_upid
}, },
{ {
header: "Status", header: gettext("Status"),
dataIndex: 'status', dataIndex: 'status',
width: 200, width: 200,
renderer: function(value, metaData, record) { renderer: function(value, metaData, record) {

View File

@ -8,15 +8,15 @@ Ext.define('PVE.form.ViewSelector', {
var default_views = { var default_views = {
server: { server: {
text: 'Server View', text: gettext('Server View'),
groups: ['node'] groups: ['node']
}, },
folder: { folder: {
text: 'Folder View', text: gettext('Folder View'),
groups: ['type'] groups: ['type']
}, },
storage: { storage: {
text: 'Storage View', text: gettext('Storage View'),
groups: ['node'], groups: ['node'],
filterfn: function(node) { filterfn: function(node) {
return node.data.type === 'storage'; return node.data.type === 'storage';

View File

@ -174,11 +174,11 @@ Ext.define('PVE.grid.ResourceGrid', {
}; };
Ext.apply(me, { Ext.apply(me, {
title: 'Search', title: gettext('Search'),
store: store, store: store,
tbar: [ tbar: [
'->', '->',
'Search:', ' ', gettext('Search') + ':', ' ',
{ {
xtype: 'textfield', xtype: 'textfield',
width: 200, width: 200,

View File

@ -12,14 +12,13 @@ use PVE::REST;
sub send_output { sub send_output {
my ($r, $data) = @_; my ($r, $data) = @_;
my $encdata = encode('UTF-8', $data);
$r->no_cache (1); $r->no_cache (1);
my $x = length ($encdata); my $x = length ($data);
$r->content_type ("text/html;charset=UTF-8"); $r->content_type ("text/html;charset=UTF-8");
$r->headers_out->set ("Content-length", "$x"); $r->headers_out->set ("Content-length", "$x");
$r->headers_out->set ("Pragma", "no-cache"); $r->headers_out->set ("Pragma", "no-cache");
$r->print ($encdata); $r->print ($data);
} }
# NOTE: Requests to this page are not authenticated # NOTE: Requests to this page are not authenticated

View File

@ -27,24 +27,24 @@ Ext.define('PVE.node.Config', {
}); });
}; };
var rebootBtn = Ext.create('PVE.button.Button', { var restartBtn = Ext.create('PVE.button.Button', {
text: 'Reboot', text: gettext('Restart'),
confirmMsg: "Do you really want to reboot node '" + nodename + "'?", confirmMsg: Ext.String.format(gettext("Do you really want to restart node {0}?"), nodename),
handler: function() { handler: function() {
node_command('reboot'); node_command('reboot');
} }
}); });
var shutdownBtn = Ext.create('PVE.button.Button', { var shutdownBtn = Ext.create('PVE.button.Button', {
text: 'Shutdown', text: gettext('Shutdown'),
confirmMsg: "Do you really want to shutdown node '" + nodename + "'?", confirmMsg: Ext.String.format(gettext("Do you really want to shutdown node {0}?"), nodename),
handler: function() { handler: function() {
node_command('shutdown'); node_command('shutdown');
} }
}); });
var shellBtn = Ext.create('Ext.Button', { var shellBtn = Ext.create('Ext.Button', {
text: 'Shell', text: gettext('Shell'),
handler: function() { handler: function() {
var url = Ext.urlEncode({ var url = Ext.urlEncode({
console: 'shell', console: 'shell',
@ -57,23 +57,23 @@ Ext.define('PVE.node.Config', {
}); });
Ext.apply(me, { Ext.apply(me, {
title: "Node '" + nodename + "'", title: gettext('Node') + " '" + nodename + "'",
hstateid: 'nodetab', hstateid: 'nodetab',
defaults: { statusStore: me.statusStore }, defaults: { statusStore: me.statusStore },
tbar: [ rebootBtn, shutdownBtn, shellBtn ], tbar: [ restartBtn, shutdownBtn, shellBtn ],
items: [ items: [
{ {
title: 'Summary', title: gettext('Summary'),
itemId: 'summary', itemId: 'summary',
xtype: 'pveNodeSummary' xtype: 'pveNodeSummary'
}, },
{ {
title: 'Services', title: gettext('Services'),
itemId: 'services', itemId: 'services',
xtype: 'pveNodeServiceView' xtype: 'pveNodeServiceView'
}, },
{ {
title: 'Network', title: gettext('Network'),
itemId: 'network', itemId: 'network',
xtype: 'pveNodeNetworkView' xtype: 'pveNodeNetworkView'
}, },
@ -83,7 +83,7 @@ Ext.define('PVE.node.Config', {
xtype: 'pveNodeDNSView' xtype: 'pveNodeDNSView'
}, },
{ {
title: 'Time', title: gettext('Time'),
itemId: 'time', itemId: 'time',
xtype: 'pveNodeTimeView' xtype: 'pveNodeTimeView'
}, },
@ -112,7 +112,7 @@ Ext.define('PVE.node.Config', {
var uptimerec = s.data.get('uptime'); var uptimerec = s.data.get('uptime');
var uptime = uptimerec ? uptimerec.data.value : false; var uptime = uptimerec ? uptimerec.data.value : false;
rebootBtn.setDisabled(!uptime); restartBtn.setDisabled(!uptime);
shutdownBtn.setDisabled(!uptime); shutdownBtn.setDisabled(!uptime);
shellBtn.setDisabled(!uptime); shellBtn.setDisabled(!uptime);
}); });

View File

@ -54,7 +54,7 @@ Ext.define('PVE.node.Tasks', {
}; };
var view_btn = new Ext.Button({ var view_btn = new Ext.Button({
text: 'View', text: gettext('View'),
disabled: true, disabled: true,
handler: run_task_viewer handler: run_task_viewer
}); });
@ -79,7 +79,7 @@ Ext.define('PVE.node.Tasks', {
} }
}, },
tbar: [ tbar: [
view_btn, '->', 'User:', ' ', view_btn, '->', gettext('User name') +':', ' ',
{ {
xtype: 'textfield', xtype: 'textfield',
width: 200, width: 200,
@ -91,7 +91,7 @@ Ext.define('PVE.node.Tasks', {
reload_task.delay(500); reload_task.delay(500);
} }
} }
}, ' ', 'Only Errors:', ' ', }, ' ', gettext('Only Errors') + ':', ' ',
{ {
xtype: 'checkbox', xtype: 'checkbox',
hideLabel: true, hideLabel: true,
@ -107,34 +107,40 @@ Ext.define('PVE.node.Tasks', {
sortableColumns: false, sortableColumns: false,
columns: [ columns: [
{ {
header: "Start Time", dataIndex: 'starttime', header: gettext("Start Time"),
dataIndex: 'starttime',
width: 100, width: 100,
renderer: function(value) { renderer: function(value) {
return Ext.Date.format(value, "M d H:i:s"); return Ext.Date.format(value, "M d H:i:s");
} }
}, },
{ {
header: "End Time", dataIndex: 'endtime', header: gettext("End Time"),
dataIndex: 'endtime',
width: 100, width: 100,
renderer: function(value, metaData, record) { renderer: function(value, metaData, record) {
return Ext.Date.format(value,"M d H:i:s"); return Ext.Date.format(value,"M d H:i:s");
} }
}, },
{ {
header: "Node", dataIndex: 'node', header: gettext("Node"),
dataIndex: 'node',
width: 100 width: 100
}, },
{ {
header: "User", dataIndex: 'user', header: gettext("User name"),
dataIndex: 'user',
width: 150 width: 150
}, },
{ {
header: "Description", dataIndex: 'upid', header: gettext("Description"),
dataIndex: 'upid',
flex: 1, flex: 1,
renderer: PVE.Utils.render_upid renderer: PVE.Utils.render_upid
}, },
{ {
header: "Status", dataIndex: 'status', header: gettext("Status"),
dataIndex: 'status',
width: 200, width: 200,
renderer: function(value, metaData, record) { renderer: function(value, metaData, record) {
if (value == 'OK') { if (value == 'OK') {

View File

@ -27,18 +27,18 @@ Ext.define('PVE.openvz.CmdMenu', {
me.items = [ me.items = [
{ {
text: 'Start', text: gettext('Start'),
icon: '/pve2/images/start.png', icon: '/pve2/images/start.png',
handler: function() { handler: function() {
vm_command('start'); vm_command('start');
} }
}, },
{ {
text: 'Shutdown', text: gettext('Shutdown'),
icon: '/pve2/images/stop.png', icon: '/pve2/images/stop.png',
handler: function() { handler: function() {
var msg = "Do you really want to shutdown the VM?"; var msg = Ext.String.format(gettext("Do you really want to shutdown VM {0}?"), me.vmid);
Ext.Msg.confirm('Confirmation', msg, function(btn) { Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
if (btn !== 'yes') { if (btn !== 'yes') {
return; return;
} }
@ -48,7 +48,7 @@ Ext.define('PVE.openvz.CmdMenu', {
} }
}, },
{ {
text: 'Console', text: gettext('Console'),
icon: '/pve2/images/display.png', icon: '/pve2/images/display.png',
handler: function() { handler: function() {
PVE.Utils.openConoleWindow('openvz', me.vmid, me.nodename); PVE.Utils.openConoleWindow('openvz', me.vmid, me.nodename);

View File

@ -33,30 +33,30 @@ Ext.define('PVE.openvz.Config', {
}; };
var startBtn = Ext.create('Ext.Button', { var startBtn = Ext.create('Ext.Button', {
text: 'Start', text: gettext('Start'),
handler: function() { handler: function() {
vm_command('start'); vm_command('start');
} }
}); });
var stopBtn = Ext.create('PVE.button.Button', { var stopBtn = Ext.create('PVE.button.Button', {
text: 'Stop', text: gettext('Stop'),
confirmMsg: "Do you really want to stop the VM?", confirmMsg: Ext.String.format(gettext("Do you really want to stop VM {0}?"), vmid),
handler: function() { handler: function() {
vm_command("stop", { fast: 1 }); vm_command("stop", { fast: 1 });
} }
}); });
var shutdownBtn = Ext.create('PVE.button.Button', { var shutdownBtn = Ext.create('PVE.button.Button', {
text: 'Shutdown', text: gettext('Shutdown'),
confirmMsg: "Do you really want to shutdown the VM?", confirmMsg: Ext.String.format(gettext("Do you really want to shutdown VM {0}?"), vmid),
handler: function() { handler: function() {
vm_command('stop'); vm_command('stop');
} }
}); });
var migrateBtn = Ext.create('Ext.Button', { var migrateBtn = Ext.create('Ext.Button', {
text: 'Migrate', text: gettext('Migrate'),
handler: function() { handler: function() {
var win = Ext.create('PVE.window.Migrate', { var win = Ext.create('PVE.window.Migrate', {
vmtype: 'openvz', vmtype: 'openvz',
@ -68,9 +68,8 @@ Ext.define('PVE.openvz.Config', {
}); });
var removeBtn = Ext.create('PVE.button.Button', { var removeBtn = Ext.create('PVE.button.Button', {
text: 'Remove', text: gettext('Remove'),
confirmMsg: 'Are you sure you want to remove VM ' + confirmMsg: Ext.String.format(gettext('Are you sure you want to remove VM {0}? This will permanently erase all VM data.'), vmid),
vmid + '? This will permanently erase all VM data.',
handler: function() { handler: function() {
PVE.Utils.API2Request({ PVE.Utils.API2Request({
url: '/nodes/' + nodename + '/openvz/' + vmid, url: '/nodes/' + nodename + '/openvz/' + vmid,
@ -84,34 +83,34 @@ Ext.define('PVE.openvz.Config', {
}); });
var consoleBtn = Ext.create('Ext.Button', { var consoleBtn = Ext.create('Ext.Button', {
text: 'Console', text: gettext('Console'),
handler: function() { handler: function() {
PVE.Utils.openConoleWindow('openvz', vmid, nodename); PVE.Utils.openConoleWindow('openvz', vmid, nodename);
} }
}); });
var vmname = me.pveSelNode.data.name; var vmname = me.pveSelNode.data.name;
var descr = vmname ? " '" + vmname + "'" : ''; var descr = vmid + " (" + (vmname ? "'" + vmname + "' " : "'CT " + vmid + "'") + ")";
Ext.apply(me, { Ext.apply(me, {
title: "OpenVZ container " + vmid + descr + title: Ext.String.format(gettext("Container {0} on node {1}"), descr, "'" + nodename + "'"),
" on node '" + nodename + "'",
hstateid: 'ovztab', hstateid: 'ovztab',
tbar: [ startBtn, stopBtn, shutdownBtn, migrateBtn, tbar: [ startBtn, stopBtn, shutdownBtn, migrateBtn,
removeBtn, consoleBtn ], removeBtn, consoleBtn ],
defaults: { statusStore: me.statusStore }, defaults: { statusStore: me.statusStore },
items: [ items: [
{ {
title: 'Summary', title: gettext('Summary'),
xtype: 'pveOpenVZSummary', xtype: 'pveOpenVZSummary',
itemId: 'summary' itemId: 'summary'
}, },
{ {
title: 'Ressources', title: gettext('Resources'),
itemId: 'ressources', itemId: 'resources',
xtype: 'pveOpenVZRessourceView' xtype: 'pveOpenVZRessourceView'
}, },
{ {
title: 'Network', title: gettext('Network'),
itemId: 'network', itemId: 'network',
xtype: 'pveOpenVZNetworkView' xtype: 'pveOpenVZNetworkView'
}, },
@ -121,7 +120,7 @@ Ext.define('PVE.openvz.Config', {
xtype: 'pveOpenVZDNS' xtype: 'pveOpenVZDNS'
}, },
{ {
title: 'Options', title: gettext('Options'),
itemId: 'options', itemId: 'options',
xtype: 'pveOpenVZOptions' xtype: 'pveOpenVZOptions'
}, },
@ -138,12 +137,12 @@ Ext.define('PVE.openvz.Config', {
url: '/api2/extjs/nodes/' + nodename + '/openvz/' + vmid + '/initlog' url: '/api2/extjs/nodes/' + nodename + '/openvz/' + vmid + '/initlog'
}, },
{ {
title: gettext('Backup'),
xtype: 'pveBackupView', xtype: 'pveBackupView',
title: 'Backup',
itemId: 'backup' itemId: 'backup'
}, },
{ {
title: 'Permissions', title: gettext('Permissions'),
itemId: 'permissions', itemId: 'permissions',
html: 'permissions ' + vmid html: 'permissions ' + vmid
} }

View File

@ -33,12 +33,12 @@ Ext.define('PVE.panel.StatusPanel', {
items: [ items: [
{ {
itemId: 'tasks', itemId: 'tasks',
title: 'Recent tasks', title: gettext('Tasks'),
xtype: 'pveClusterTasks' xtype: 'pveClusterTasks'
}, },
{ {
itemId: 'clog', itemId: 'clog',
title: 'Cluster log', title: gettext('Cluster log'),
xtype: 'pveClusterLog' xtype: 'pveClusterLog'
} }
] ]

View File

@ -27,18 +27,18 @@ Ext.define('PVE.qemu.CmdMenu', {
me.items = [ me.items = [
{ {
text: 'Start', text: gettext('Start'),
icon: '/pve2/images/start.png', icon: '/pve2/images/start.png',
handler: function() { handler: function() {
vm_command('start'); vm_command('start');
} }
}, },
{ {
text: 'Shutdown', text: gettext('Shutdown'),
icon: '/pve2/images/stop.png', icon: '/pve2/images/stop.png',
handler: function() { handler: function() {
var msg = "Do you really want to shutdown the VM?"; var msg = Ext.String.format(gettext("Do you really want to shutdown VM {0}?"), me.vmid);
Ext.Msg.confirm('Confirmation', msg, function(btn) { Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
if (btn !== 'yes') { if (btn !== 'yes') {
return; return;
} }
@ -48,7 +48,7 @@ Ext.define('PVE.qemu.CmdMenu', {
} }
}, },
{ {
text: 'Console', text: gettext('Console'),
icon: '/pve2/images/display.png', icon: '/pve2/images/display.png',
handler: function() { handler: function() {
PVE.Utils.openConoleWindow('kvm', me.vmid, me.nodename); PVE.Utils.openConoleWindow('kvm', me.vmid, me.nodename);

View File

@ -33,22 +33,22 @@ Ext.define('PVE.qemu.Config', {
}; };
var startBtn = Ext.create('Ext.Button', { var startBtn = Ext.create('Ext.Button', {
text: 'Start', text: gettext('Start'),
handler: function() { handler: function() {
vm_command('start'); vm_command('start');
} }
}); });
var stopBtn = Ext.create('PVE.button.Button', { var stopBtn = Ext.create('PVE.button.Button', {
text: 'Stop', text: gettext('Stop'),
confirmMsg: "Do you really want to stop the VM?", confirmMsg: Ext.String.format(gettext("Do you really want to stop VM {0}?"), vmid),
handler: function() { handler: function() {
vm_command("stop", { timeout: 30 }); vm_command("stop", { timeout: 30 });
} }
}); });
var migrateBtn = Ext.create('Ext.Button', { var migrateBtn = Ext.create('Ext.Button', {
text: 'Migrate', text: gettext('Migrate'),
handler: function() { handler: function() {
var win = Ext.create('PVE.window.Migrate', { var win = Ext.create('PVE.window.Migrate', {
vmtype: 'qemu', vmtype: 'qemu',
@ -60,8 +60,8 @@ Ext.define('PVE.qemu.Config', {
}); });
var resetBtn = Ext.create('PVE.button.Button', { var resetBtn = Ext.create('PVE.button.Button', {
text: 'Reset', text: gettext('Reset'),
confirmMsg: "Do you really want to reset the VM?", confirmMsg: Ext.String.format(gettext("Do you really want to reset VM {0}?"), vmid),
handler: function() { handler: function() {
vm_command("reset"); vm_command("reset");
} }
@ -69,16 +69,15 @@ Ext.define('PVE.qemu.Config', {
var shutdownBtn = Ext.create('PVE.button.Button', { var shutdownBtn = Ext.create('PVE.button.Button', {
text: gettext('Shutdown'), text: gettext('Shutdown'),
confirmMsg: "Do you really want to shutdown the VM?", confirmMsg: Ext.String.format(gettext("Do you really want to shutdown VM {0}?"), vmid),
handler: function() { handler: function() {
vm_command('shutdown', { timeout: 30 }); vm_command('shutdown', { timeout: 30 });
} }
}); });
var removeBtn = Ext.create('PVE.button.Button', { var removeBtn = Ext.create('PVE.button.Button', {
text: 'Remove', text: gettext('Remove'),
confirmMsg: 'Are you sure you want to remove VM ' + confirmMsg: Ext.String.format(gettext('Are you sure you want to remove VM {0}? This will permanently erase all VM data.'), vmid),
vmid + '? This will permanently erase all VM data.',
handler: function() { handler: function() {
PVE.Utils.API2Request({ PVE.Utils.API2Request({
url: '/nodes/' + nodename + '/qemu/' + vmid, url: '/nodes/' + nodename + '/qemu/' + vmid,
@ -92,49 +91,49 @@ Ext.define('PVE.qemu.Config', {
}); });
var consoleBtn = Ext.create('Ext.Button', { var consoleBtn = Ext.create('Ext.Button', {
text: 'Console', text: gettext('Console'),
handler: function() { handler: function() {
PVE.Utils.openConoleWindow('kvm', vmid, nodename); PVE.Utils.openConoleWindow('kvm', vmid, nodename);
} }
}); });
var vmname = me.pveSelNode.data.name; var vmname = me.pveSelNode.data.name;
var descr = vmname ? "'" + vmname + "' " : ''; var descr = vmid + " (" + (vmname ? "'" + vmname + "' " : "'VM " + vmid + "'") + ")";
Ext.apply(me, { Ext.apply(me, {
title: "Virtual machine " + descr + "'KVM " + vmid + title: Ext.String.format(gettext("Virtual machine {0} on node {1}"), descr, "'" + nodename + "'"),
"' on node '" + nodename + "'",
hstateid: 'kvmtab', hstateid: 'kvmtab',
tbar: [ startBtn, stopBtn, resetBtn, shutdownBtn, tbar: [ startBtn, stopBtn, resetBtn, shutdownBtn,
migrateBtn, removeBtn, consoleBtn ], migrateBtn, removeBtn, consoleBtn ],
defaults: { statusStore: me.statusStore }, defaults: { statusStore: me.statusStore },
items: [ items: [
{ {
title: 'Summary', title: gettext('Summary'),
xtype: 'pveQemuSummary', xtype: 'pveQemuSummary',
itemId: 'summary' itemId: 'summary'
}, },
{ {
title: 'Hardware', title: gettext('Hardware'),
itemId: 'hardware', itemId: 'hardware',
xtype: 'PVE.qemu.HardwareView' xtype: 'PVE.qemu.HardwareView'
}, },
{ {
title: 'Options', title: gettext('Options'),
itemId: 'options', itemId: 'options',
xtype: 'PVE.qemu.Options' xtype: 'PVE.qemu.Options'
}, },
{ {
title: 'Monitor', title: gettext('Monitor'),
itemId: 'monitor', itemId: 'monitor',
xtype: 'pveQemuMonitor' xtype: 'pveQemuMonitor'
}, },
{ {
title: gettext('Backup'),
xtype: 'pveBackupView', xtype: 'pveBackupView',
title: 'Backup',
itemId: 'backup' itemId: 'backup'
}, },
{ {
title: 'Permissions', title: gettext('Permissions'),
itemId: 'permissions', itemId: 'permissions',
html: 'permissions ' + vmid html: 'permissions ' + vmid
} }

View File

@ -16,21 +16,22 @@ Ext.define('PVE.storage.Browser', {
} }
Ext.apply(me, { Ext.apply(me, {
title: "Storage '" + storeid + "'" + "' on node '" + nodename + "'", title: Ext.String.format(gettext("Storage {0} on node {1}"),
"'" + storeid + "'", "'" + nodename + "'"),
hstateid: 'storagetab', hstateid: 'storagetab',
items: [ items: [
{ {
title: 'Summary', title: gettext('Summary'),
xtype: 'pveStorageSummary', xtype: 'pveStorageSummary',
itemId: 'summary' itemId: 'summary'
}, },
{ {
xtype: 'pveStorageContentView', xtype: 'pveStorageContentView',
title: 'Content', title: gettext('Content'),
itemId: 'content' itemId: 'content'
}, },
{ {
title: 'Permissions', title: gettext('Permissions'),
itemId: 'permissions', itemId: 'permissions',
html: 'Permissions ' html: 'Permissions '
} }

View File

@ -10,19 +10,19 @@ Ext.define('PVE.tree.ResourceTree', {
typeDefaults: { typeDefaults: {
node: { node: {
iconCls: 'x-tree-node-server', iconCls: 'x-tree-node-server',
text: 'Node list' text: gettext('Node list')
}, },
storage: { storage: {
iconCls: 'x-tree-node-harddisk', iconCls: 'x-tree-node-harddisk',
text: 'Storage list' text: gettext('Storage list')
}, },
qemu: { qemu: {
iconCls: 'x-tree-node-computer', iconCls: 'x-tree-node-computer',
text: 'Virtual machines' text: gettext('Virtual machines')
}, },
openvz: { openvz: {
iconCls: 'x-tree-node-openvz', iconCls: 'x-tree-node-openvz',
text: 'OpenVZ containers' text: gettext('OpenVZ containers')
} }
} }
}, },
@ -182,7 +182,7 @@ Ext.define('PVE.tree.ResourceTree', {
root: { root: {
expanded: true, expanded: true,
id: 'root', id: 'root',
text: "Datacenter" text: gettext('Datacenter')
} }
}); });