UI: localization

-Put localization wrappers around listView, detailView widgets

-Add initial localization for instances section
This commit is contained in:
Brian Federle 2012-02-09 10:39:46 -08:00
parent 13f059d07e
commit d2284e4439
17 changed files with 637 additions and 410 deletions

View File

@ -1,8 +1,25 @@
#cloudstack 3.0 (begin) ********************************************************************************************
create.template.confirm=Please confirm that you want to create a template
create.template.success=New template is being created
create.template.notification=Creating new template
label.view=View
create.template.complete=Template has been created successfully
create.template.confirm=Please confirm that you want to create a template
create.template.notification=Creating new template
create.template.success=New template is being created
instances.actions.reboot.label=Reboot instance
label.filterBy=Filter by
label.ok=OK
notification.reboot.instance=Reboot instance
notification.start.instance=Start instance
notification.stop.instance=Stop instance
label.display.name=Display name
label.zone.name=Zone name
ui.listView.filters.all=All
ui.listView.filters.mine=Mine
state.Running=Running
state.Stopped=Stopped
state.Destroyed=Destroyed
state.Error=Error
message.reset.password.warning.notPasswordEnabled=The template this instance was created with is not password enabled
message.reset.password.warning.notStopped=Your instance must be stopped before attempting to change its current password
#cloudstack 3.0 (end) **********************************************************************************************

View File

@ -1598,10 +1598,83 @@
</html>
<script language="javascript">
dictionary = {
'create.template.confirm' : '<fmt:message key="create.template.confirm"/>',
'create.template.success' : '<fmt:message key="create.template.success"/>',
'create.template.notification' : '<fmt:message key="create.template.notification"/>',
'create.template.complete' : '<fmt:message key="create.template.complete"/>'
dictionary = {
'message.action.change.service.warning.for.instance': '<fmt:message key="message.action.change.service.warning.for.instance"/>',
'label.service.offering': '<fmt:message key="label.service.offering"/>',
'label.action.change.service': '<fmt:message key="label.action.change.service"/>',
'message.reset.password.warning.notStopped': '<fmt:message key="message.reset.password.warning.notStopped"/>',
'message.reset.password.warning.notPasswordEnabled': '<fmt:message key="message.reset.password.warning.notPasswordEnabled"/>',
'message.action.instance.reset.password': '<fmt:message key="message.action.instance.reset.password"/>',
'label.action.reset.password': '<fmt:message key="label.action.reset.password"/>',
'message.detach.iso.confirm': '<fmt:message key="message.detach.iso.confirm"/>',
'label.detach.iso': '<fmt:message key="label.detach.iso"/>',
'label.attach.iso': '<fmt:message key="label.attach.iso"/>',
'label.action.restore.instance': '<fmt:message key="label.action.restore.instance"/>',
'message.action.restore.instance': '<fmt:message key="message.action.restore.instance"/>',
'message.action.destroy.instance': '<fmt:message key="message.action.destroy.instance"/>',
'label.action.destroy.instance': '<fmt:message key="label.action.destroy.instance"/>',
'message.action.reboot.instance': '<fmt:message key="message.action.reboot.instance"/>',
'label.action.reboot.instance': '<fmt:message key="label.action.reboot.instance"/>',
'message.action.stop.instance': '<fmt:message key="message.action.stop.instance"/>',
'label.action.stop.instance': '<fmt:message key="label.action.stop.instance"/>',
'message.action.start.instance': '<fmt:message key="message.action.start.instance"/>',
'label.action.start.instance': '<fmt:message key="label.action.start.instance"/>',
'label.volumes': '<fmt:message key="label.volumes"/>',
'label.view': '<fmt:message key="label.view"/>',
'label.created': '<fmt:message key="label.created"/>',
'label.account': '<fmt:message key="label.account"/>',
'label.domain': '<fmt:message key="label.domain"/>',
'label.attached.iso': '<fmt:message key="label.attached.iso"/>',
'label.ha.enabled': '<fmt:message key="label.ha.enabled"/>',
'label.host': '<fmt:message key="label.host"/>',
'label.group': '<fmt:message key="label.group"/>',
'label.service.offering': '<fmt:message key="label.service.offering"/>',
'label.os.type': '<fmt:message key="label.os.type"/>',
'label.template': '<fmt:message key="label.template"/>',
'label.hypervisor': '<fmt:message key="label.hypervisor"/>',
'label.id': '<fmt:message key="label.id"/>',
'label.no': '<fmt:message key="label.no"/>',
'label.yes': '<fmt:message key="label.yes"/>',
'label.is.default': '<fmt:message key="label.is.default"/>',
'label.netmask': '<fmt:message key="label.netmask"/>',
'label.gateway': '<fmt:message key="label.gateway"/>',
'label.type': '<fmt:message key="label.type"/>',
'label.ip.address': '<fmt:message key="label.ip.address"/>',
'label.name': '<fmt:message key="label.name"/>',
'label.nics': '<fmt:message key="label.nics"/>',
'label.details': '<fmt:message key="label.details"/>',
'label.state': '<fmt:message key="label.state"/>',
'state.Running': '<fmt:message key="state.Running"/>',
'state.Stopped': '<fmt:message key="state.Stopped"/>',
'state.Destroyed': '<fmt:message key="state.Destroyed"/>',
'state.Error': '<fmt:message key="state.Error"/>',
'label.actions': '<fmt:message key="label.actions"/>',
'create.template.complete' : '<fmt:message key="create.template.complete"/>',
'create.template.confirm' : '<fmt:message key="create.template.confirm"/>',
'create.template.notification' : '<fmt:message key="create.template.notification"/>',
'create.template.success' : '<fmt:message key="create.template.success"/>',
'force.stop': '<fmt:message key="force.stop"/>',
'instances.actions.reboot.label': '<fmt:message key="instances.actions.reboot.label"/>',
'label.action.destroy.instance': '<fmt:message key="label.action.destroy.instance"/>',
'label.action.start.instance': '<fmt:message key="label.action.start.instance"/>',
'label.action.stop.instance': '<fmt:message key="label.action.stop.instance"/>',
'label.filterBy': '<fmt:message key="label.filterBy"/>',
'label.instances': '<fmt:message key="label.instances"/>',
'label.name': '<fmt:message key="label.name"/>',
'label.ok': '<fmt:message key="label.ok"/>',
'label.vm.add': '<fmt:message key="label.vm.add"/>',
'action.destroy.instance': '<fmt:message key="action.destroy.instance"/>',
'action.reboot.instance': '<fmt:message key="action.reboot.instance"/>',
'action.start.instance': '<fmt:message key="action.start.instance"/>',
'action.stop.instance': '<fmt:message key="action.stop.instance"/>',
'notification.reboot.instance': '<fmt:message key="notification.reboot.instance"/>',
'notification.start.instance': '<fmt:message key="notification.start.instance"/>',
'label.display.name': '<fmt:message key="label.display.name"/>',
'label.zone.name': '<fmt:message key="label.zone.name"/>',
'ui.listView.filters.all': '<fmt:message key="ui.listView.filters.all"/>',
'ui.listView.filters.destroyed': '<fmt:message key="ui.listView.filters.destroyed"/>',
'ui.listView.filters.mine': '<fmt:message key="ui.listView.filters.mine"/>',
'ui.listView.filters.running': '<fmt:message key="ui.listView.filters.running"/>',
'ui.listView.filters.stopped': '<fmt:message key="ui.listView.filters.stopped"/>'
};
</script>
</script>

View File

@ -33,7 +33,14 @@
}
},
domain: { label: 'Domain' },
state: { label: 'State', indicator: { 'enabled': 'on', 'Destroyed': 'off', 'disabled': 'off' } }
state: {
converter: function(str) {
// For localization
return str;
},
label: 'State',
indicator: { 'enabled': 'on', 'Destroyed': 'off', 'disabled': 'off' }
}
},
actions: {

View File

@ -307,5 +307,10 @@
};
cloudStack.uiCustom.login(loginArgs);
// Localization
cloudStack.localizationFn = function(str) {
return dictionary[str];
};
});
})(cloudStack, jQuery);

View File

@ -989,7 +989,13 @@
label: 'Network offerings',
fields: {
name: { label: 'Name' },
state: { label: 'State', indicator: { 'Enabled': 'on', 'Disabled': 'off', 'Destroyed': 'off' }}
state: {
converter: function(str) {
// For localization
return str;
},
label: 'State', indicator: { 'Enabled': 'on', 'Disabled': 'off', 'Destroyed': 'off' }
}
},
dataProvider: function(args) {

File diff suppressed because it is too large Load Diff

View File

@ -851,7 +851,13 @@
//vlanname: { label: 'VLAN' },
iselastic: { label: 'Elastic', converter: cloudStack.converters.toBooleanText },
account: { label: 'Account' },
state: { label: 'State', indicator: { 'Allocated': 'on', 'Released': 'off' } }
state: {
converter: function(str) {
// For localization
return str;
},
label: 'State', indicator: { 'Allocated': 'on', 'Released': 'off' }
}
},
actions: {
add: {

View File

@ -552,7 +552,13 @@
displaytext: { label: 'Display Text' },
domain: { label: 'Domain' },
account: { label: 'Owner' },
state: { label: 'Status', indicator: { 'Active': 'on', 'Destroyed': 'off', 'Disabled': 'off', 'Left Project': 'off' } }
state: {
converter: function(str) {
// For localization
return str;
},
label: 'Status', indicator: { 'Active': 'on', 'Destroyed': 'off', 'Disabled': 'off', 'Left Project': 'off' }
}
},
dataProvider: function(args) {
@ -880,6 +886,10 @@
domain: { label: 'Domain' },
state: {
label: 'Status',
converter: function(str) {
// For localization
return str;
},
indicator: {
'Accepted': 'on', 'Completed': 'on',
'Pending': 'off', 'Declined': 'off'

View File

@ -23,7 +23,13 @@
type: { label: 'Type' },
storagetype: { label: 'Storage Type' },
vmdisplayname: { label: 'VM Display Name' },
state: { label: 'State', indicator: { 'Ready': 'on' } }
state: {
converter: function(str) {
// For localization
return str;
},
label: 'State', indicator: { 'Ready': 'on' }
}
},
// List view actions
@ -899,7 +905,13 @@
volumename: { label: 'Volume' },
intervaltype: { label: 'Interval Type' },
created: { label: 'Date', converter: cloudStack.converters.toLocalDate },
state: { label: 'State', indicator: { 'BackedUp': 'on', 'Destroyed': 'off' } }
state: {
converter: function(str) {
// For localization
return str;
},
label: 'State', indicator: { 'BackedUp': 'on', 'Destroyed': 'off' }
}
},
dataProvider: function(args) {

View File

@ -207,6 +207,10 @@
name: { label: 'Name' },
state: {
label: 'State',
converter: function(str) {
// For localization
return str;
},
indicator: { 'Enabled': 'on', 'Disabled': 'off' }
}
},
@ -1627,7 +1631,13 @@
hideToolbar: true,
fields: {
name: { label: 'Name' },
state: { label: 'State', indicator: { 'Enabled': 'on', 'Disabled': 'off' }},
state: {
converter: function(str) {
// For localization
return str;
},
label: 'State', indicator: { 'Enabled': 'on', 'Disabled': 'off' }
},
vlan: { label: 'VLAN Range' }
}
},
@ -1869,6 +1879,10 @@
name: { label: 'Name' },
zonename: { label: 'Zone' },
state: {
converter: function(str) {
// For localization
return str;
},
label: 'Status',
indicator: {
'Running': 'on',
@ -3040,10 +3054,17 @@
return "No";
}
},
allocationstate: { label: 'Allocation State', indicator: {
'Enabled': 'on',
'Disabled': 'off'
} }
allocationstate: {
label: 'Allocation State',
converter: function(str) {
// For localization
return str;
},
indicator: {
'Enabled': 'on',
'Disabled': 'off'
}
}
},
actions: {
add: {
@ -3373,6 +3394,10 @@
zonename: { label: 'Zone' },
state: {
label: 'Status',
converter: function(str) {
// For localization
return str;
},
indicator: {
'Running': 'on',
'Stopped': 'off',
@ -3711,7 +3736,13 @@
id: 'netscalerProviders',
fields: {
ipaddress: { label: 'IP Address' },
lbdevicestate: { label: 'Status' }
lbdevicestate: {
converter: function(str) {
// For localization
return str;
},
label: 'Status'
}
},
dataProvider: function(args) {
$.ajax({
@ -3916,7 +3947,13 @@
id: 'f5Providers',
fields: {
ipaddress: { label: 'IP Address' },
lbdevicestate: { label: 'Status' }
lbdevicestate: {
converter: function(str) {
// For localization
return str;
},
label: 'Status'
}
},
actions: {
add: {
@ -4115,7 +4152,13 @@
id: 'srxProviders',
fields: {
ipaddress: { label: 'IP Address' },
lbdevicestate: { label: 'Status' }
lbdevicestate: {
converter: function(str) {
// For localization
return str;
},
label: 'Status'
}
},
actions: {
add: {
@ -4319,7 +4362,13 @@
name: { label: 'Name' },
gateway: { label: 'Gateway' },
netmask: { label: 'Netmask' },
allocationstate: { label: 'Allocation Status' }
allocationstate: {
converter: function(str) {
// For localization
return str;
},
label: 'Allocation Status'
}
},
dataProvider: function(args) {
@ -4582,7 +4631,13 @@
startip: { label: 'Start IP Range', isEditable: true },
endip: { label: 'End IP Range', isEditable: true },
gateway: { label: 'Gateway', isEditable: true },
allocationstate: { label: 'Allocation Status' }
allocationstate: {
converter: function(str) {
// For localization
return str;
},
label: 'Allocation Status'
}
}
],
@ -4632,7 +4687,14 @@
hypervisortype: { label: 'Hypervisor' },
//allocationstate: { label: 'Allocation State' },
//managedstate: { label: 'Managed State' },
state: { label: 'State', indicator: { 'Enabled': 'on', 'Destroyed': 'off'} }
state: {
converter: function(str) {
// For localization
return str;
},
label: 'State',
indicator: { 'Enabled': 'on', 'Destroyed': 'off'}
}
},
dataProvider: function(args) {

View File

@ -39,16 +39,16 @@
messages: {
confirm: function(args) {
return dictionary["create.template.confirm"];
return "create.template.confirm";
},
success: function(args) {
return dictionary["create.template.success"];
return "create.template.success";
},
notification: function(args) {
return dictionary["create.template.notification"];
return "create.template.notification";
},
complete: function(args) {
return dictionary["create.template.complete"];
return "create.template.complete";
}
},

View File

@ -31,7 +31,7 @@
.addClass('navigation-item')
.addClass(sectionID)
.append($('<span>').addClass('icon').html('&nbsp;'))
.append($('<span>').html(args.title))
.append($('<span>').html(_l(args.title)))
.data('cloudStack-section-id', sectionID);
$li.appendTo($navList);
@ -67,7 +67,7 @@
// Reset browser panels
$browser.cloudBrowser('removeAllPanels');
$panel = $browser.cloudBrowser('addPanel', {
title: data.title,
title: _l(data.title),
data: ''
});
@ -98,7 +98,7 @@
// Total notifications
.append($('<span>').html(0))
)
.append($('<span>').html('Notifications'))
.append($('<span>').html(_l('Notifications')))
.notifications();
// Project switcher
@ -106,7 +106,7 @@
.append(
// Default View
$('<div>').addClass('select default-view active')
.html('Default View')
.html(_l('Default View'))
.prepend(
$('<span>').addClass('icon').html('&nbsp;')
)
@ -114,7 +114,7 @@
.append(
// Project View
$('<div>').addClass('select project-view')
.html('Project View')
.html(_l('Project View'))
.prepend(
$('<span>').addClass('icon').html('&nbsp;')
)
@ -157,7 +157,7 @@
// Put project name in header
$('.select.project-view').html(
'<span class="icon">&nbsp;</span> Project View'
'<span class="icon">&nbsp;</span>' + _l('Project View')
).attr('title', '');
// Clear out project
@ -249,7 +249,7 @@
$(['Logout', 'Help']).each(function() {
var $link = $('<a>')
.attr({ href: '#' })
.html(this.toString())
.html(_l(this.toString()))
.appendTo($options);
if (this == 'Help') {
@ -351,4 +351,5 @@
return true;
});
});
})(jQuery, window.cloudStack ? window.cloudStack : window.cloudStack = {});
})(window.jQuery,
window.cloudStack ? window.cloudStack : window.cloudStack = {});

View File

@ -1,4 +1,4 @@
(function($, cloudStack) {
(function($, cloudStack, _l) {
cloudStack.dialog = {
/**
* Error message form
@ -19,7 +19,9 @@
*/
createForm: function(args) {
var $formContainer = $('<div>').addClass('form-container');
var $message = $('<span>').addClass('message').appendTo($formContainer).html(args.form.desc);
var $message = $('<span>').addClass('message').appendTo($formContainer).html(
_l(args.form.desc)
);
var $form = $('<form>').appendTo($formContainer)
.submit(function() {
$(this).closest('.ui-dialog').find('button.ok').click();
@ -55,7 +57,7 @@
var $name = $('<div>').addClass('name')
.appendTo($formItem)
.append(
$('<label>').html(field.label + ':')
$('<label>').html(_l(field.label) + ':')
);
// Add 'required asterisk' if field is required
@ -65,7 +67,7 @@
// Tooltip description
if (field.desc) {
$formItem.attr({ title: field.desc });
$formItem.attr({ title: _l(field.desc) });
}
// Input area
@ -201,7 +203,7 @@
$('<div>').addClass('item')
.append(
$.merge(
$('<div>').addClass('name').html(itemValue.label),
$('<div>').addClass('name').html(_l(itemValue.label)),
$('<div>').addClass('value').append(
$('<input>').attr({ name: itemKey, type: 'checkbox' }).appendTo($value)
)
@ -273,7 +275,7 @@
}
$input.data('validation-rules', field.validation);
$('<label>').addClass('error').appendTo($value).html('*required');
$('<label>').addClass('error').appendTo($value).html('*' + _l('required'));
});
$form.find('select').trigger('change');
@ -322,7 +324,7 @@
return $formContainer.dialog({
dialogClass: 'create-form',
width: 400,
title: args.form.title,
title: _l(args.form.title),
open: function() {
if (args.form.preFilter) {
args.form.preFilter({ $form: $form, context: args.context });
@ -330,7 +332,7 @@
},
buttons: [
{
text: createLabel ? createLabel : 'OK',
text: createLabel ? createLabel : _l('label.ok'),
'class': 'ok',
click: function() {
if (!complete($formContainer)) { return false; }
@ -343,7 +345,7 @@
}
},
{
text: 'Cancel',
text: _l('label.cancel'),
'class': 'cancel',
click: function() {
$('div.overlay').remove();
@ -361,7 +363,7 @@
confirm: function(args) {
return $(
$('<span>').addClass('message').html(
args.message
_l(args.message)
)
).dialog({
title: 'Confirm',
@ -396,7 +398,7 @@
notice: function(args) {
return $(
$('<span>').addClass('message').html(
args.message
_l(args.message)
)
).dialog({
title: 'Status',
@ -404,7 +406,7 @@
zIndex: 5000,
buttons: [
{
text: 'Close',
text: _l('Close'),
'class': 'close',
click: function() {
$(this).dialog('destroy');
@ -415,4 +417,4 @@
});
}
};
})(jQuery, cloudStack);
})(window.jQuery, window.cloudStack, window._l);

View File

@ -41,4 +41,17 @@
}
});
};
/**
* Localization -- shortcut _l
*
* Takes string and runs through localization function -- if no code
* exists or function isn't present, return string as-is
*/
cloudStack.localize = window._l = function(str) {
var localized = cloudStack.localizationFn ?
cloudStack.localizationFn(str) : null;
return localized ? localized : str;
};
})(jQuery, cloudStack);

View File

@ -1,4 +1,4 @@
(function($, cloudStack) {
(function($, cloudStack, _l) {
var replaceListViewItem = function($detailView, newData) {
var $row = $detailView.data('list-view-row');
@ -257,7 +257,7 @@
var $inputs = $detailView.find('input, select');
var action = args.actions[args.actionName];
var id = $detailView.data('view-args').id;
var $editButton = $('<div>').addClass('button done').html('Apply').hide()
var $editButton = $('<div>').addClass('button done').html(_l('Apply')).hide()
.appendTo(
$detailView.find('.ui-tabs-panel .detail-group.actions')
).fadeIn();
@ -276,7 +276,7 @@
var val = $input.is(':checked');
$value.data('detail-view-boolean-value', val);
$value.html(val ? 'Yes' : 'No');
$value.html(val ? _l('Yes') : _l('No'));
}
else if ($input.is('select')) {
$value.html(
@ -532,8 +532,8 @@
var $actionLink = $('<a></a>')
.attr({
href: '#',
title: value.label,
alt: value.label,
title: _l(value.label),
alt: _l(value.label),
'detail-action': key
})
.data('detail-view-action-callback', value.action)
@ -635,7 +635,7 @@
isOddRow = true;
}
$name.html(value.label);
$name.html(_l(value.label));
$value.html(content);
// Set up editable metadata
@ -702,7 +702,7 @@
.attr({ href: '#' })
.data('detail-view-link-view-all', detailViewArgs.viewAll)
.append(
$('<span>').html('View ' + detailViewArgs.viewAll.label)
$('<span>').html(_l('label.view') + ' ' + _l(detailViewArgs.viewAll.label))
)
)
.append(
@ -846,7 +846,7 @@
var $tabLink = $('<a></a>').attr({
href: '#details-tab-' + propGroup
}).html(title).appendTo($tab);
}).html(_l(title)).appendTo($tab);
var $tabContent = $('<div>').attr({
id: 'details-tab-' + propGroup
@ -880,7 +880,7 @@
$('<div>')
.addClass('button refresh')
.append(
$('<span>').html('Refresh')
$('<span>').html(_l('Refresh'))
)
);
};
@ -982,4 +982,4 @@
return true;
});
}(jQuery, cloudStack));
}(window.jQuery, window.cloudStack, window._l));

View File

@ -1,7 +1,7 @@
/**
* Create dynamic list view based on data callbacks
*/
(function($, cloudStack) {
(function($, cloudStack, _l) {
var uiActions = {
standard: function($instanceRow, args, additional) {
var listViewArgs = $instanceRow.closest('div.list-view').data('view-args');
@ -409,8 +409,12 @@
{
section: $instanceRow.closest('div.view').data('view-args').id,
desc: newName ?
'Set value of ' + $instanceRow.find('td.name span').html() + ' to ' + newName :
'Unset value for ' + $instanceRow.find('td.name span').html()
_l('Set value of') +
' ' + $instanceRow.find('td.name span').html() +
' ' + _l('to') +
' ' + newName :
_l('Unset value for') +
' ' + $instanceRow.find('td.name span').html()
},
function(args) {},
[{ name: newName }]
@ -500,10 +504,10 @@
});
var $actionButton = $('<div></div>').addClass('action');
var $saveButton = $actionButton.clone().addClass('save').attr({
'title': 'Save'
'title': _l('Save')
});
var $cancelButton = $actionButton.clone().addClass('cancel').attr({
'title': 'Cancel edit'
'title': _l('Cancel edit')
});
$([$editField, $saveButton, $cancelButton]).each(function() {
@ -534,19 +538,19 @@
if ($th.index()) $th.addClass('reduced-hide');
$th.html(field.label);
$th.html(_l(field.label));
});
if (reorder) {
$thead.find('tr').append(
$('<th>').html('Order').addClass('reorder-actions reduced-hide')
$('<th>').html(_l('Order')).addClass('reorder-actions reduced-hide')
);
}
if (actions && renderActionCol(actions)) {
$thead.find('tr').append(
$('<th></th>')
.html('Actions')
.html(_l('label.actions'))
.addClass('actions reduced-hide')
);
}
@ -558,7 +562,7 @@
if (!filters) return false;
var $filters = $('<div></div>').addClass('filters reduced-hide');
$filters.append('<label>Filter By: </label>');
$filters.append($('<label>').html(_l('label.filterBy')));
var $filterSelect = $('<select id="filterBy"></select>').appendTo($filters);
@ -569,7 +573,7 @@
}
var $option = $('<option>').attr({
value: key
}).html(this.label);
}).html(_l(this.label));
$option.appendTo($filterSelect);
});
@ -609,8 +613,8 @@
})
)
.attr({
alt: action.label,
title: action.label
alt: _l(action.label),
title: _l(action.label)
})
.data('list-view-action-id', actionName)
);
@ -628,8 +632,8 @@
})
)
.attr({
alt: action.label,
title: action.label
alt: _l(action.label),
title: _l(action.label)
})
.data('list-view-action-id', actionName)
);
@ -642,8 +646,8 @@
.addClass(actionName)
.append($('<span>').addClass('icon'))
.attr({
alt: action.label,
title: action.label
alt: _l(action.label),
title: _l(action.label)
})
.data('list-view-action-id', actionName);
@ -707,7 +711,7 @@
if (!$tbody.find('tr').size()) {
return [
$('<tr>').addClass('empty').append(
$('<td>').html('No data to show')
$('<td>').html(_l('No data to show'))
).appendTo($tbody)
];
}
@ -748,7 +752,7 @@
$td.data('list-view-action', key);
}
if (field.converter) {
content = field.converter(content, dataItem);
content = _l(field.converter(content, dataItem));
}
$td.html(content);
@ -809,7 +813,7 @@
$('<span>').addClass('icon').html('&nbsp;')
)
.attr({
title: fnLabel[actionName]
title: _l(fnLabel[actionName])
})
.appendTo($td)
.click(function() {
@ -952,7 +956,7 @@
error: function(args) {
setLoadingArgs.loadingCompleted();
addTableRows(fields, [], $tbody, actions);
$table.find('td:first').html('ERROR');
$table.find('td:first').html(_l('ERROR'));
$table.dataTable(null, { noSelect: uiCustom });
}
}
@ -979,7 +983,7 @@
if (args.sectionSelect) {
$('<label>')
.prependTo($sectionSelect.parent())
.html(args.sectionSelect.label + ':');
.html(_l(args.sectionSelect.label) + ':');
sectionPreFilter = args.sectionSelect.preFilter ?
args.sectionSelect.preFilter({
@ -993,7 +997,7 @@
if (sectionPreFilter && sectionPreFilter.length == 1) {
$switcher.find('select').hide();
$switcher.find('label').html(
'Viewing ' + sections[sectionPreFilter[0]].title
_l('Viewing') + ' ' + _l(sections[sectionPreFilter[0]].title)
);
}
@ -1012,7 +1016,7 @@
.addClass(key)
.attr({ href: '#' })
.data('list-view-section-id', key)
.html(this.title)
.html(_l(this.title))
);
$sectionButton.appendTo($switcher);
@ -1020,7 +1024,7 @@
$sectionSelect.append(
$('<option></option>')
.attr('value', key)
.html(this.title)
.html(_l(this.title))
);
}
@ -1113,7 +1117,7 @@
.addClass('button action add reduced-hide')
.data('list-view-action-id', 'add')
.append(
$('<span>').html(listViewData.actions.add.label)
$('<span>').html(_l(listViewData.actions.add.label))
)
);
}
@ -1134,7 +1138,7 @@
.addClass('button action main-action reduced-hide').addClass(actionName)
.data('list-view-action-id', actionName)
.append($('<span>').addClass('icon'))
.append($('<span>').html(action.label))
.append($('<span>').html(_l(action.label)))
);
return true;
@ -1143,7 +1147,10 @@
$('<tbody>').appendTo($table);
createHeader(listViewData.fields, $table, listViewData.actions, { reorder: reorder });
createHeader(listViewData.fields,
$table,
listViewData.actions,
{ reorder: reorder });
createFilters($toolbar, listViewData.filters);
createSearchBar($toolbar);
@ -1503,4 +1510,4 @@
$listView.listView('refresh');
});
});
})(jQuery, cloudStack);
})(jQuery, cloudStack, _l);

View File

@ -1,4 +1,4 @@
(function($, cloudStack) {
(function($, cloudStack, _l) {
/**
* Notification handling
*/
@ -14,14 +14,14 @@
.append(
$('<div>').addClass('title').append(
$('<span>').html(
options.error ? options.error : 'Task completed'
options.error ? options.error : _l('Task completed')
)
)
)
.append(
$('<div>').addClass('message')
.append(
$('<span>').html(args.message)
$('<span>').html(_l(args.message))
)
);
@ -57,7 +57,7 @@
var $item = $('<li>')
.append(
$('<span>').html(args.desc)
$('<span>').html(_l(args.desc))
)
.append(
$('<div>').addClass('remove')
@ -94,7 +94,9 @@
clearInterval(pollTimer);
notifications.activeTasks.pop(pollTimer);
notifications.cornerAlert({ message: $item.html() }, { error: 'Task: ERROR' });
notifications.cornerAlert({ message: $item.html() }, {
error: _l('ERROR')
});
$item.removeClass('pending').addClass('error');
if (additionalComplete) additionalComplete();
@ -153,7 +155,7 @@
.addClass('notification-box')
.append(
// Header
$('<h3>').html('Notifications')
$('<h3>').html(_l('Notifications'))
)
.append(
// Container
@ -170,13 +172,13 @@
// Clear list
$('<div>').addClass('button clear-list')
.append(
$('<span>').html('Clear List')
$('<span>').html(_l('Clear List'))
)
)
.append(
$('<div>').addClass('button close')
.append(
$('<span>').html('Close')
$('<span>').html(_l('Close'))
)
)
)
@ -344,4 +346,4 @@
if ($popup.size())
notifications.popup.reposition($popup, $popup.data('notifications-attach-to'));
});
})(window.jQuery, cloudStack);
})(window.jQuery, window.cloudStack, window._l);