From a2dca26b09b2c9a3500b9a8592d7ec0eecd2a9ef Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 22 Nov 2011 09:18:56 +0100 Subject: [PATCH] mark translateable strings with gettext --- www/manager/Utils.js | 44 ++++++++++++----------- www/manager/VNCConsole.js | 60 ++++++++++++++++---------------- www/manager/Workspace.js | 9 ++--- www/manager/button/Button.js | 2 +- www/manager/dc/Config.js | 18 +++++----- www/manager/dc/Log.js | 12 +++---- www/manager/dc/Tasks.js | 12 +++---- www/manager/form/ViewSelector.js | 6 ++-- www/manager/grid/ResourceGrid.js | 4 +-- www/manager/index.pl | 5 ++- www/manager/node/Config.js | 26 +++++++------- www/manager/node/Tasks.js | 24 ++++++++----- www/manager/openvz/CmdMenu.js | 10 +++--- www/manager/openvz/Config.js | 39 ++++++++++----------- www/manager/panel/StatusPanel.js | 4 +-- www/manager/qemu/CmdMenu.js | 10 +++--- www/manager/qemu/Config.js | 39 ++++++++++----------- www/manager/storage/Browser.js | 9 ++--- www/manager/tree/ResourceTree.js | 10 +++--- 19 files changed, 176 insertions(+), 167 deletions(-) diff --git a/www/manager/Utils.js b/www/manager/Utils.js index 6b00c68d..7a5fdc14 100644 --- a/www/manager/Utils.js +++ b/www/manager/Utils.js @@ -30,39 +30,39 @@ Ext.apply(Ext.form.field.VTypes, { IPAddress: function(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, MacAddress: function(v) { return (/^([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}$/).test(v); }, 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) { return (/^vmbr\d{1,4}$/).test(v); }, - BridgeNameText: 'Allowable bridge names: vmbrN, where 0 <= N <= 9999', + BridgeNameText: gettext('Format') + ': vmbrN, where 0 <= N <= 9999', BondName: function(v) { return (/^bond\d{1,4}$/).test(v); }, - BondNameText: 'Allowable bond names: bondN, where 0 <= N <= 9999', + BondNameText: gettext('Format') + ': bondN, where 0 <= N <= 9999', 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); }, - 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) { 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) { return (/^http:\/\/.*$/).test(v); }, - HttpProxyText: "Must confirm to schema 'http://.*' (example: 'http://username:password@host:port/')" + HttpProxyText: gettext('Example') + ": http://username:password@host:port/" }); // we dont want that a displayfield set the form dirty flag! @@ -244,10 +244,10 @@ Ext.define('PVE.Utils', { statics: { }, extractRequestError: function(result, verbose) { - var msg = 'Successful'; + var msg = gettext('Successful'); if (!result.success) { - msg = "Unknown error"; + msg = gettext("Unknown error"); if (result.message) { msg = result.message; if (result.status) { @@ -270,10 +270,10 @@ Ext.define('PVE.Utils', { statics: { var msg; switch (action.failureType) { 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; case Ext.form.action.Action.CONNECT_FAILURE: - msg = 'Connect failure'; + msg = gettext('Connection error'); var resp = action.response; if (resp.status && resp.statusText) { msg += " " + resp.status + ": " + resp.statusText; @@ -291,7 +291,7 @@ Ext.define('PVE.Utils', { statics: { API2Request: function(reqOpts) { var newopts = Ext.apply({ - waitMsg: 'Please wait...' + waitMsg: gettext('Please wait...') }, reqOpts); if (!newopts.url.match(/^\/api2/)) { @@ -324,13 +324,13 @@ Ext.define('PVE.Utils', { statics: { try { response.result = Ext.decode(response.responseText); } catch(e) {} - var msg = "Connection error - server offline?"; + var msg = gettext('Connection error') + ' - server offline?'; if (response.aborted) { - msg = 'Transaction aborted.'; + msg = gettext('Connection error') + ' - aborted.'; } else if (response.timedout) { - msg = 'Communication failure: Timeout.'; + msg = gettext('Connection error') + ' - Timeout.'; } else if (response.status && response.statusText) { - msg = 'Connection error ' + response.status + ': ' + response.statusText; + msg = gettext('Connection error') + ' ' + response.status + ': ' + response.statusText; } response.htmlStatus = msg; 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) { 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) { - return value ? 'Yes' : 'No'; + return value ? PVE.Utils.yesText : PVE.Utils.noText; }, format_neg_boolean: function(value) { - return !value ? 'Yes' : 'No'; + return !value ? PVE.Utils.yesText : PVE.Utils.noText; }, format_content_types: function(value) { diff --git a/www/manager/VNCConsole.js b/www/manager/VNCConsole.js index 6c033096..e918b82e 100644 --- a/www/manager/VNCConsole.js +++ b/www/manager/VNCConsole.js @@ -228,16 +228,16 @@ Ext.define('PVE.KVMConsole', { var tbar = [ { - text: 'Start', + text: gettext('Start'), handler: function() { vm_command("start", {}, 1); } }, { - text: 'Stop', + text: gettext('Stop'), handler: function() { - var msg = "Do you really want to stop the VM?"; - Ext.Msg.confirm('Confirm', msg, function(btn) { + var msg = Ext.String.format(gettext("Do you really want to stop VM {0}?"), me.vmid); + Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) { if (btn !== 'yes') { return; } @@ -251,10 +251,10 @@ Ext.define('PVE.KVMConsole', { vmid: me.vmid }, { - text: 'Reset', + text: gettext('Reset'), handler: function() { - var msg = "Do you really want to reset the VM?"; - Ext.Msg.confirm('Confirm', msg, function(btn) { + var msg = Ext.String.format(gettext("Do you really want to reset VM {0}?"), me.vmid); + Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) { if (btn !== 'yes') { return; } @@ -263,10 +263,10 @@ Ext.define('PVE.KVMConsole', { } }, { - text: 'Shutdown', + text: gettext('Shutdown'), handler: function() { - var msg = "Do you really want to shutdown the VM?"; - Ext.Msg.confirm('Confirm', msg, function(btn) { + var msg = Ext.String.format(gettext("Do you really want to shutdown VM {0}?"), me.vmid); + Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) { if (btn !== 'yes') { return; } @@ -275,10 +275,10 @@ Ext.define('PVE.KVMConsole', { } }, { - text: 'Suspend', + text: gettext('Suspend'), handler: function() { - var msg = "Do you really want to suspend the VM?"; - Ext.Msg.confirm('Confirm', msg, function(btn) { + var msg = Ext.String.format(gettext("Do you really want to suspend VM {0}?"), me.vmid); + Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) { if (btn !== 'yes') { return; } @@ -287,27 +287,27 @@ Ext.define('PVE.KVMConsole', { } }, { - text: 'Resume', + text: gettext('Resume'), handler: function() { vm_command("resume"); } }, '->', { - text: 'Refresh', + text: gettext('Refresh'), handler: function() { var applet = Ext.getDom(me.appletID); applet.sendRefreshRequest(); } }, { - text: 'Reload', + text: gettext('Reload'), handler: function () { me.reloadApplet(); } }, { - text: 'Console', + text: gettext('Console'), handler: function() { var url = Ext.urlEncode({ console: 'kvm', @@ -364,16 +364,16 @@ Ext.define('PVE.OpenVZConsole', { var tbar = [ { - text: 'Start', + text: gettext('Start'), handler: function() { vm_command("start", {}, 1); } }, { - text: 'Stop', + text: gettext('Stop'), handler: function() { - var msg = "Do you really want to stop the VM?"; - Ext.Msg.confirm('Confirm', msg, function(btn) { + var msg = Ext.String.format(gettext("Do you really want to stop VM {0}?"), me.vmid); + Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) { if (btn !== 'yes') { return; } @@ -382,10 +382,10 @@ Ext.define('PVE.OpenVZConsole', { } }, { - text: 'Shutdown', + text: gettext('Shutdown'), handler: function() { - var msg = "Do you really want to shutdown the VM?"; - Ext.Msg.confirm('Confirm', msg, function(btn) { + var msg = Ext.String.format(gettext("Do you really want to shutdown VM {0}?"), me.vmid); + Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) { if (btn !== 'yes') { return; } @@ -395,20 +395,20 @@ Ext.define('PVE.OpenVZConsole', { }, '->', { - text: 'Refresh', + text: gettext('Refresh'), handler: function() { var applet = Ext.getDom(me.appletID); applet.sendRefreshRequest(); } }, { - text: 'Reload', + text: gettext('Reload'), handler: function () { me.reloadApplet(); } }, { - text: 'Console', + text: gettext('Console'), handler: function() { var url = Ext.urlEncode({ console: 'openvz', @@ -445,18 +445,18 @@ Ext.define('PVE.Shell', { var tbar = [ '->', { - text: 'Refresh', + text: gettext('Refresh'), handler: function() { var applet = Ext.getDom(me.appletID); applet.sendRefreshRequest(); } }, { - text: 'Reload', + text: gettext('Reload'), handler: function () { me.reloadApplet(); } }, { - text: 'Shell', + text: gettext('Shell'), handler: function() { var url = Ext.urlEncode({ console: 'shell', diff --git a/www/manager/Workspace.js b/www/manager/Workspace.js index e1095fd2..2c3e10bb 100644 --- a/www/manager/Workspace.js +++ b/www/manager/Workspace.js @@ -208,7 +208,8 @@ Ext.define('PVE.StdWorkspace', { var ui = me.query('#userinfo')[0]; if (PVE.UserName) { - ui.update('
You are logged in as "' + PVE.UserName + '"
'); + var msg = Ext.String.format(gettext("You are logged in as {0}"), "'" + PVE.UserName + "'"); + ui.update('
' + msg + '
'); } else { ui.update(''); } @@ -304,7 +305,7 @@ Ext.define('PVE.StdWorkspace', { margins: '3 5 0 0', xtype: 'button', baseCls: 'x-btn', - text: "Logout", + text: gettext("Logout"), handler: function() { PVE.data.ResourceStore.stopUpdate(); me.showLogin(); @@ -318,7 +319,7 @@ Ext.define('PVE.StdWorkspace', { margins: '3 5 0 0', xtype: 'button', baseCls: 'x-btn', - text: "Create VM", + text: gettext("Create VM"), handler: function() { var wiz = Ext.create('PVE.qemu.CreateWizard', {}); wiz.show(); @@ -329,7 +330,7 @@ Ext.define('PVE.StdWorkspace', { margins: '3 5 0 0', xtype: 'button', baseCls: 'x-btn', - text: "Create CT", + text: gettext("Create CT"), handler: function() { var wiz = Ext.create('PVE.openvz.CreateWizard', {}); wiz.show(); diff --git a/www/manager/button/Button.js b/www/manager/button/Button.js index a5acedf2..86cf7382 100644 --- a/www/manager/button/Button.js +++ b/www/manager/button/Button.js @@ -37,7 +37,7 @@ Ext.define('PVE.button.Button', { if (Ext.isFunction(me.confirmMsg)) { msg = me.confirmMsg(rec); } - Ext.Msg.confirm('Confirmation', msg, function(btn) { + Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) { if (btn !== 'yes') { return; } diff --git a/www/manager/dc/Config.js b/www/manager/dc/Config.js index ee9fc6bb..b2a7f7ba 100644 --- a/www/manager/dc/Config.js +++ b/www/manager/dc/Config.js @@ -6,47 +6,47 @@ Ext.define('PVE.dc.Config', { var me = this; Ext.apply(me, { - title: "Datacenter", + title: gettext("Datacenter"), hstateid: 'dctab', items: [ { xtype: 'pveDcOptionView', - title: 'Options', + title: gettext('Options'), itemId: 'options' }, { xtype: 'pveStorageView', - title: 'Storage', + title: gettext('Storage'), itemId: 'storage' }, { xtype: 'pveDcBackupView', - title: 'Backup', + title: gettext('Backup'), itemId: 'backup' }, { xtype: 'pveUserView', - title: 'Users', + title: gettext('Users'), itemId: 'users' }, { xtype: 'pveGroupView', - title: 'Groups', + title: gettext('Groups'), itemId: 'groups' }, { xtype: 'pveACLView', - title: 'Permissions', + title: gettext('Permissions'), itemId: 'permissions' }, { xtype: 'pveRoleView', - title: 'Roles', + title: gettext('Roles'), itemId: 'roles' }, { xtype: 'pveAuthView', - title: 'Authentication', + title: gettext('Authentication'), itemId: 'domains' } ] diff --git a/www/manager/dc/Log.js b/www/manager/dc/Log.js index fb0d8657..f3db5d4c 100644 --- a/www/manager/dc/Log.js +++ b/www/manager/dc/Log.js @@ -39,7 +39,7 @@ Ext.define('PVE.dc.Log', { sortableColumns: false, columns: [ { - header: "Start Time", + header: gettext("Time"), dataIndex: 'time', width: 100, renderer: function(value) { @@ -47,12 +47,12 @@ Ext.define('PVE.dc.Log', { } }, { - header: "Node", + header: gettext("Node"), dataIndex: 'node', width: 100 }, { - header: "Tag", + header: gettext("Service"), dataIndex: 'tag', width: 100 }, @@ -62,18 +62,18 @@ Ext.define('PVE.dc.Log', { width: 100 }, { - header: "User", + header: gettext("User name"), dataIndex: 'user', width: 150 }, { - header: "Severity", + header: gettext("Severity"), dataIndex: 'pri', renderer: PVE.Utils.render_serverity, width: 100 }, { - header: "Message", + header: gettext("Message"), dataIndex: 'msg', flex: 1 } diff --git a/www/manager/dc/Tasks.js b/www/manager/dc/Tasks.js index 766a37d9..2f5bc0ad 100644 --- a/www/manager/dc/Tasks.js +++ b/www/manager/dc/Tasks.js @@ -58,7 +58,7 @@ Ext.define('PVE.dc.Tasks', { sortableColumns: false, columns: [ { - header: "Start Time", + header: gettext("Start Time"), dataIndex: 'starttime', width: 100, renderer: function(value) { @@ -66,7 +66,7 @@ Ext.define('PVE.dc.Tasks', { } }, { - header: "End Time", + header: gettext("End Time"), dataIndex: 'endtime', width: 100, renderer: function(value, metaData, record) { @@ -78,23 +78,23 @@ Ext.define('PVE.dc.Tasks', { } }, { - header: "Node", + header: gettext("Node"), dataIndex: 'node', width: 100 }, { - header: "User", + header: gettext("User name"), dataIndex: 'user', width: 150 }, { - header: "Description", + header: gettext("Description"), dataIndex: 'upid', flex: 1, renderer: PVE.Utils.render_upid }, { - header: "Status", + header: gettext("Status"), dataIndex: 'status', width: 200, renderer: function(value, metaData, record) { diff --git a/www/manager/form/ViewSelector.js b/www/manager/form/ViewSelector.js index 79bc532c..d971f522 100644 --- a/www/manager/form/ViewSelector.js +++ b/www/manager/form/ViewSelector.js @@ -8,15 +8,15 @@ Ext.define('PVE.form.ViewSelector', { var default_views = { server: { - text: 'Server View', + text: gettext('Server View'), groups: ['node'] }, folder: { - text: 'Folder View', + text: gettext('Folder View'), groups: ['type'] }, storage: { - text: 'Storage View', + text: gettext('Storage View'), groups: ['node'], filterfn: function(node) { return node.data.type === 'storage'; diff --git a/www/manager/grid/ResourceGrid.js b/www/manager/grid/ResourceGrid.js index 6d27d32f..39c335c2 100644 --- a/www/manager/grid/ResourceGrid.js +++ b/www/manager/grid/ResourceGrid.js @@ -174,11 +174,11 @@ Ext.define('PVE.grid.ResourceGrid', { }; Ext.apply(me, { - title: 'Search', + title: gettext('Search'), store: store, tbar: [ '->', - 'Search:', ' ', + gettext('Search') + ':', ' ', { xtype: 'textfield', width: 200, diff --git a/www/manager/index.pl b/www/manager/index.pl index 82c6bb76..7f91863a 100644 --- a/www/manager/index.pl +++ b/www/manager/index.pl @@ -12,14 +12,13 @@ use PVE::REST; sub send_output { my ($r, $data) = @_; - my $encdata = encode('UTF-8', $data); $r->no_cache (1); - my $x = length ($encdata); + my $x = length ($data); $r->content_type ("text/html;charset=UTF-8"); $r->headers_out->set ("Content-length", "$x"); $r->headers_out->set ("Pragma", "no-cache"); - $r->print ($encdata); + $r->print ($data); } # NOTE: Requests to this page are not authenticated diff --git a/www/manager/node/Config.js b/www/manager/node/Config.js index ab4f2f6a..92af5279 100644 --- a/www/manager/node/Config.js +++ b/www/manager/node/Config.js @@ -27,24 +27,24 @@ Ext.define('PVE.node.Config', { }); }; - var rebootBtn = Ext.create('PVE.button.Button', { - text: 'Reboot', - confirmMsg: "Do you really want to reboot node '" + nodename + "'?", + var restartBtn = Ext.create('PVE.button.Button', { + text: gettext('Restart'), + confirmMsg: Ext.String.format(gettext("Do you really want to restart node {0}?"), nodename), handler: function() { node_command('reboot'); } }); var shutdownBtn = Ext.create('PVE.button.Button', { - text: 'Shutdown', - confirmMsg: "Do you really want to shutdown node '" + nodename + "'?", + text: gettext('Shutdown'), + confirmMsg: Ext.String.format(gettext("Do you really want to shutdown node {0}?"), nodename), handler: function() { node_command('shutdown'); } }); var shellBtn = Ext.create('Ext.Button', { - text: 'Shell', + text: gettext('Shell'), handler: function() { var url = Ext.urlEncode({ console: 'shell', @@ -57,23 +57,23 @@ Ext.define('PVE.node.Config', { }); Ext.apply(me, { - title: "Node '" + nodename + "'", + title: gettext('Node') + " '" + nodename + "'", hstateid: 'nodetab', defaults: { statusStore: me.statusStore }, - tbar: [ rebootBtn, shutdownBtn, shellBtn ], + tbar: [ restartBtn, shutdownBtn, shellBtn ], items: [ { - title: 'Summary', + title: gettext('Summary'), itemId: 'summary', xtype: 'pveNodeSummary' }, { - title: 'Services', + title: gettext('Services'), itemId: 'services', xtype: 'pveNodeServiceView' }, { - title: 'Network', + title: gettext('Network'), itemId: 'network', xtype: 'pveNodeNetworkView' }, @@ -83,7 +83,7 @@ Ext.define('PVE.node.Config', { xtype: 'pveNodeDNSView' }, { - title: 'Time', + title: gettext('Time'), itemId: 'time', xtype: 'pveNodeTimeView' }, @@ -112,7 +112,7 @@ Ext.define('PVE.node.Config', { var uptimerec = s.data.get('uptime'); var uptime = uptimerec ? uptimerec.data.value : false; - rebootBtn.setDisabled(!uptime); + restartBtn.setDisabled(!uptime); shutdownBtn.setDisabled(!uptime); shellBtn.setDisabled(!uptime); }); diff --git a/www/manager/node/Tasks.js b/www/manager/node/Tasks.js index e411a848..86642936 100644 --- a/www/manager/node/Tasks.js +++ b/www/manager/node/Tasks.js @@ -54,7 +54,7 @@ Ext.define('PVE.node.Tasks', { }; var view_btn = new Ext.Button({ - text: 'View', + text: gettext('View'), disabled: true, handler: run_task_viewer }); @@ -79,7 +79,7 @@ Ext.define('PVE.node.Tasks', { } }, tbar: [ - view_btn, '->', 'User:', ' ', + view_btn, '->', gettext('User name') +':', ' ', { xtype: 'textfield', width: 200, @@ -91,7 +91,7 @@ Ext.define('PVE.node.Tasks', { reload_task.delay(500); } } - }, ' ', 'Only Errors:', ' ', + }, ' ', gettext('Only Errors') + ':', ' ', { xtype: 'checkbox', hideLabel: true, @@ -107,34 +107,40 @@ Ext.define('PVE.node.Tasks', { sortableColumns: false, columns: [ { - header: "Start Time", dataIndex: 'starttime', + header: gettext("Start Time"), + dataIndex: 'starttime', width: 100, renderer: function(value) { return Ext.Date.format(value, "M d H:i:s"); } }, { - header: "End Time", dataIndex: 'endtime', + header: gettext("End Time"), + dataIndex: 'endtime', width: 100, renderer: function(value, metaData, record) { return Ext.Date.format(value,"M d H:i:s"); } }, { - header: "Node", dataIndex: 'node', + header: gettext("Node"), + dataIndex: 'node', width: 100 }, { - header: "User", dataIndex: 'user', + header: gettext("User name"), + dataIndex: 'user', width: 150 }, { - header: "Description", dataIndex: 'upid', + header: gettext("Description"), + dataIndex: 'upid', flex: 1, renderer: PVE.Utils.render_upid }, { - header: "Status", dataIndex: 'status', + header: gettext("Status"), + dataIndex: 'status', width: 200, renderer: function(value, metaData, record) { if (value == 'OK') { diff --git a/www/manager/openvz/CmdMenu.js b/www/manager/openvz/CmdMenu.js index 0b72142e..44d5758e 100644 --- a/www/manager/openvz/CmdMenu.js +++ b/www/manager/openvz/CmdMenu.js @@ -27,18 +27,18 @@ Ext.define('PVE.openvz.CmdMenu', { me.items = [ { - text: 'Start', + text: gettext('Start'), icon: '/pve2/images/start.png', handler: function() { vm_command('start'); } }, { - text: 'Shutdown', + text: gettext('Shutdown'), icon: '/pve2/images/stop.png', handler: function() { - var msg = "Do you really want to shutdown the VM?"; - Ext.Msg.confirm('Confirmation', msg, function(btn) { + var msg = Ext.String.format(gettext("Do you really want to shutdown VM {0}?"), me.vmid); + Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) { if (btn !== 'yes') { return; } @@ -48,7 +48,7 @@ Ext.define('PVE.openvz.CmdMenu', { } }, { - text: 'Console', + text: gettext('Console'), icon: '/pve2/images/display.png', handler: function() { PVE.Utils.openConoleWindow('openvz', me.vmid, me.nodename); diff --git a/www/manager/openvz/Config.js b/www/manager/openvz/Config.js index c1d6ba42..4f013af2 100644 --- a/www/manager/openvz/Config.js +++ b/www/manager/openvz/Config.js @@ -33,30 +33,30 @@ Ext.define('PVE.openvz.Config', { }; var startBtn = Ext.create('Ext.Button', { - text: 'Start', + text: gettext('Start'), handler: function() { vm_command('start'); } }); var stopBtn = Ext.create('PVE.button.Button', { - text: 'Stop', - confirmMsg: "Do you really want to stop the VM?", + text: gettext('Stop'), + confirmMsg: Ext.String.format(gettext("Do you really want to stop VM {0}?"), vmid), handler: function() { vm_command("stop", { fast: 1 }); } }); var shutdownBtn = Ext.create('PVE.button.Button', { - text: 'Shutdown', - confirmMsg: "Do you really want to shutdown the VM?", + text: gettext('Shutdown'), + confirmMsg: Ext.String.format(gettext("Do you really want to shutdown VM {0}?"), vmid), handler: function() { vm_command('stop'); } }); var migrateBtn = Ext.create('Ext.Button', { - text: 'Migrate', + text: gettext('Migrate'), handler: function() { var win = Ext.create('PVE.window.Migrate', { vmtype: 'openvz', @@ -68,9 +68,8 @@ Ext.define('PVE.openvz.Config', { }); var removeBtn = Ext.create('PVE.button.Button', { - text: 'Remove', - confirmMsg: 'Are you sure you want to remove VM ' + - vmid + '? This will permanently erase all VM data.', + text: gettext('Remove'), + confirmMsg: Ext.String.format(gettext('Are you sure you want to remove VM {0}? This will permanently erase all VM data.'), vmid), handler: function() { PVE.Utils.API2Request({ url: '/nodes/' + nodename + '/openvz/' + vmid, @@ -84,34 +83,34 @@ Ext.define('PVE.openvz.Config', { }); var consoleBtn = Ext.create('Ext.Button', { - text: 'Console', + text: gettext('Console'), handler: function() { PVE.Utils.openConoleWindow('openvz', vmid, nodename); } }); var vmname = me.pveSelNode.data.name; - var descr = vmname ? " '" + vmname + "'" : ''; + var descr = vmid + " (" + (vmname ? "'" + vmname + "' " : "'CT " + vmid + "'") + ")"; + Ext.apply(me, { - title: "OpenVZ container " + vmid + descr + - " on node '" + nodename + "'", + title: Ext.String.format(gettext("Container {0} on node {1}"), descr, "'" + nodename + "'"), hstateid: 'ovztab', tbar: [ startBtn, stopBtn, shutdownBtn, migrateBtn, removeBtn, consoleBtn ], defaults: { statusStore: me.statusStore }, items: [ { - title: 'Summary', + title: gettext('Summary'), xtype: 'pveOpenVZSummary', itemId: 'summary' }, { - title: 'Ressources', - itemId: 'ressources', + title: gettext('Resources'), + itemId: 'resources', xtype: 'pveOpenVZRessourceView' }, { - title: 'Network', + title: gettext('Network'), itemId: 'network', xtype: 'pveOpenVZNetworkView' }, @@ -121,7 +120,7 @@ Ext.define('PVE.openvz.Config', { xtype: 'pveOpenVZDNS' }, { - title: 'Options', + title: gettext('Options'), itemId: 'options', xtype: 'pveOpenVZOptions' }, @@ -138,12 +137,12 @@ Ext.define('PVE.openvz.Config', { url: '/api2/extjs/nodes/' + nodename + '/openvz/' + vmid + '/initlog' }, { + title: gettext('Backup'), xtype: 'pveBackupView', - title: 'Backup', itemId: 'backup' }, { - title: 'Permissions', + title: gettext('Permissions'), itemId: 'permissions', html: 'permissions ' + vmid } diff --git a/www/manager/panel/StatusPanel.js b/www/manager/panel/StatusPanel.js index b474dab3..ed0d4f37 100644 --- a/www/manager/panel/StatusPanel.js +++ b/www/manager/panel/StatusPanel.js @@ -33,12 +33,12 @@ Ext.define('PVE.panel.StatusPanel', { items: [ { itemId: 'tasks', - title: 'Recent tasks', + title: gettext('Tasks'), xtype: 'pveClusterTasks' }, { itemId: 'clog', - title: 'Cluster log', + title: gettext('Cluster log'), xtype: 'pveClusterLog' } ] diff --git a/www/manager/qemu/CmdMenu.js b/www/manager/qemu/CmdMenu.js index 584c827a..8bf146f6 100644 --- a/www/manager/qemu/CmdMenu.js +++ b/www/manager/qemu/CmdMenu.js @@ -27,18 +27,18 @@ Ext.define('PVE.qemu.CmdMenu', { me.items = [ { - text: 'Start', + text: gettext('Start'), icon: '/pve2/images/start.png', handler: function() { vm_command('start'); } }, { - text: 'Shutdown', + text: gettext('Shutdown'), icon: '/pve2/images/stop.png', handler: function() { - var msg = "Do you really want to shutdown the VM?"; - Ext.Msg.confirm('Confirmation', msg, function(btn) { + var msg = Ext.String.format(gettext("Do you really want to shutdown VM {0}?"), me.vmid); + Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) { if (btn !== 'yes') { return; } @@ -48,7 +48,7 @@ Ext.define('PVE.qemu.CmdMenu', { } }, { - text: 'Console', + text: gettext('Console'), icon: '/pve2/images/display.png', handler: function() { PVE.Utils.openConoleWindow('kvm', me.vmid, me.nodename); diff --git a/www/manager/qemu/Config.js b/www/manager/qemu/Config.js index 908c770e..5f115b24 100644 --- a/www/manager/qemu/Config.js +++ b/www/manager/qemu/Config.js @@ -33,22 +33,22 @@ Ext.define('PVE.qemu.Config', { }; var startBtn = Ext.create('Ext.Button', { - text: 'Start', + text: gettext('Start'), handler: function() { vm_command('start'); } }); var stopBtn = Ext.create('PVE.button.Button', { - text: 'Stop', - confirmMsg: "Do you really want to stop the VM?", + text: gettext('Stop'), + confirmMsg: Ext.String.format(gettext("Do you really want to stop VM {0}?"), vmid), handler: function() { vm_command("stop", { timeout: 30 }); } }); var migrateBtn = Ext.create('Ext.Button', { - text: 'Migrate', + text: gettext('Migrate'), handler: function() { var win = Ext.create('PVE.window.Migrate', { vmtype: 'qemu', @@ -60,8 +60,8 @@ Ext.define('PVE.qemu.Config', { }); var resetBtn = Ext.create('PVE.button.Button', { - text: 'Reset', - confirmMsg: "Do you really want to reset the VM?", + text: gettext('Reset'), + confirmMsg: Ext.String.format(gettext("Do you really want to reset VM {0}?"), vmid), handler: function() { vm_command("reset"); } @@ -69,16 +69,15 @@ Ext.define('PVE.qemu.Config', { var shutdownBtn = Ext.create('PVE.button.Button', { 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() { vm_command('shutdown', { timeout: 30 }); } }); var removeBtn = Ext.create('PVE.button.Button', { - text: 'Remove', - confirmMsg: 'Are you sure you want to remove VM ' + - vmid + '? This will permanently erase all VM data.', + text: gettext('Remove'), + confirmMsg: Ext.String.format(gettext('Are you sure you want to remove VM {0}? This will permanently erase all VM data.'), vmid), handler: function() { PVE.Utils.API2Request({ url: '/nodes/' + nodename + '/qemu/' + vmid, @@ -92,49 +91,49 @@ Ext.define('PVE.qemu.Config', { }); var consoleBtn = Ext.create('Ext.Button', { - text: 'Console', + text: gettext('Console'), handler: function() { PVE.Utils.openConoleWindow('kvm', vmid, nodename); } }); var vmname = me.pveSelNode.data.name; - var descr = vmname ? "'" + vmname + "' " : ''; + var descr = vmid + " (" + (vmname ? "'" + vmname + "' " : "'VM " + vmid + "'") + ")"; + Ext.apply(me, { - title: "Virtual machine " + descr + "'KVM " + vmid + - "' on node '" + nodename + "'", + title: Ext.String.format(gettext("Virtual machine {0} on node {1}"), descr, "'" + nodename + "'"), hstateid: 'kvmtab', tbar: [ startBtn, stopBtn, resetBtn, shutdownBtn, migrateBtn, removeBtn, consoleBtn ], defaults: { statusStore: me.statusStore }, items: [ { - title: 'Summary', + title: gettext('Summary'), xtype: 'pveQemuSummary', itemId: 'summary' }, { - title: 'Hardware', + title: gettext('Hardware'), itemId: 'hardware', xtype: 'PVE.qemu.HardwareView' }, { - title: 'Options', + title: gettext('Options'), itemId: 'options', xtype: 'PVE.qemu.Options' }, { - title: 'Monitor', + title: gettext('Monitor'), itemId: 'monitor', xtype: 'pveQemuMonitor' }, { + title: gettext('Backup'), xtype: 'pveBackupView', - title: 'Backup', itemId: 'backup' }, { - title: 'Permissions', + title: gettext('Permissions'), itemId: 'permissions', html: 'permissions ' + vmid } diff --git a/www/manager/storage/Browser.js b/www/manager/storage/Browser.js index 6b12fb4a..079997d7 100644 --- a/www/manager/storage/Browser.js +++ b/www/manager/storage/Browser.js @@ -16,21 +16,22 @@ Ext.define('PVE.storage.Browser', { } Ext.apply(me, { - title: "Storage '" + storeid + "'" + "' on node '" + nodename + "'", + title: Ext.String.format(gettext("Storage {0} on node {1}"), + "'" + storeid + "'", "'" + nodename + "'"), hstateid: 'storagetab', items: [ { - title: 'Summary', + title: gettext('Summary'), xtype: 'pveStorageSummary', itemId: 'summary' }, { xtype: 'pveStorageContentView', - title: 'Content', + title: gettext('Content'), itemId: 'content' }, { - title: 'Permissions', + title: gettext('Permissions'), itemId: 'permissions', html: 'Permissions ' } diff --git a/www/manager/tree/ResourceTree.js b/www/manager/tree/ResourceTree.js index 7b4beb02..cbacc249 100644 --- a/www/manager/tree/ResourceTree.js +++ b/www/manager/tree/ResourceTree.js @@ -10,19 +10,19 @@ Ext.define('PVE.tree.ResourceTree', { typeDefaults: { node: { iconCls: 'x-tree-node-server', - text: 'Node list' + text: gettext('Node list') }, storage: { iconCls: 'x-tree-node-harddisk', - text: 'Storage list' + text: gettext('Storage list') }, qemu: { iconCls: 'x-tree-node-computer', - text: 'Virtual machines' + text: gettext('Virtual machines') }, openvz: { iconCls: 'x-tree-node-openvz', - text: 'OpenVZ containers' + text: gettext('OpenVZ containers') } } }, @@ -182,7 +182,7 @@ Ext.define('PVE.tree.ResourceTree', { root: { expanded: true, id: 'root', - text: "Datacenter" + text: gettext('Datacenter') } });