Commit 1c5933c9 authored by Vincent Petry's avatar Vincent Petry
Browse files

Better use of promise in OC.L10N.load()

parent cd60a27a
......@@ -44,22 +44,17 @@ OC.L10N = {
}
var self = this;
var deferred = $.Deferred();
var url = OC.filePath(appName, 'l10n', OC.getLocale() + '.json');
// load JSON translation bundle per AJAX
$.get(url,
function(result) {
if (result.translations) {
self.register(appName, result.translations, result.pluralForm);
}
if (callback) {
callback();
deferred.resolve();
}
}
);
return deferred.promise();
return $.get(url)
.then(
function(result) {
if (result.translations) {
self.register(appName, result.translations, result.pluralForm);
}
})
.then(callback);
},
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment