Skip to content

Commit

Permalink
[#2809] Fix a couple of bad translation calls
Browse files Browse the repository at this point in the history
  • Loading branch information
aron committed Aug 7, 2012
1 parent a39bb4e commit 84a4123
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions ckan/public/base/javascript/modules/api-info.js
Expand Up @@ -97,7 +97,7 @@ this.ckan.module('api-info', function (jQuery, _) {
*/
loadTemplate: function () {
if (!this.options.template) {
this.sandbox.notify(this.options.i18n.noTemplate);
this.sandbox.notify(this.i18n('noTemplate'));
return jQuery.Deferred().reject().promise();
}

Expand Down Expand Up @@ -125,7 +125,7 @@ this.ckan.module('api-info', function (jQuery, _) {
/* error handler when the template fails to load */
_onTemplateError: function () {
this.loading(false);
this.sandbox.notify(this.options.i18n.loadError);
this.sandbox.notify(this.i18n('loadError'));
}
};
});
10 changes: 4 additions & 6 deletions ckan/public/base/javascript/modules/confirm-delete.js
Expand Up @@ -69,18 +69,16 @@ this.ckan.module('confirm-delete', function (jQuery, _) {
* Returns the newly created element.
*/
createModal: function () {
var i18n = this.options.i18n;

if (!this.modal) {
var element = this.modal = jQuery(this.options.template);
element.on('click', '.btn-primary', this._onConfirmSuccess);
element.on('click', '.btn-cancel', this._onConfirmCancel);
element.modal({show: false});

element.find('h3').text(i18n.heading);
element.find('.modal-body').text(i18n.content);
element.find('.btn-primary').text(i18n.confirm);
element.find('.btn-cancel').text(i18n.cancel);
element.find('h3').text(this.i18n('heading'));
element.find('.modal-body').text(this.i18n('content'));
element.find('.btn-primary').text(this.i18n('confirm'));
element.find('.btn-cancel').text(this.i18n('cancel'));
}
return this.modal;
},
Expand Down
10 changes: 5 additions & 5 deletions ckan/public/base/test/spec/modules/confirm-delete.spec.js
Expand Up @@ -74,14 +74,14 @@ describe('ckan.module.ConfirmDeleteModule()', function () {
assert.calledWith(jQuery.fn.modal, {show: false});
});

it('should insert the localsized strings', function () {
it('should insert the localized strings', function () {
var target = this.module.createModal();
var i18n = this.module.options.i18n;

assert.equal(target.find('h3').text(), i18n.heading);
assert.equal(target.find('.modal-body').text(), i18n.content);
assert.equal(target.find('.btn-primary').text(), i18n.confirm);
assert.equal(target.find('.btn-cancel').text(), i18n.cancel);
assert.equal(target.find('h3').text(), i18n.heading.fetch());
assert.equal(target.find('.modal-body').text(), i18n.content.fetch());
assert.equal(target.find('.btn-primary').text(), i18n.confirm.fetch());
assert.equal(target.find('.btn-cancel').text(), i18n.cancel.fetch());
});
});

Expand Down

0 comments on commit 84a4123

Please sign in to comment.