Better use of promise in OC.L10N.load()
This commit is contained in:
parent
cd60a27ad6
commit
1c5933c96c
|
@ -44,22 +44,17 @@ OC.L10N = {
|
||||||
}
|
}
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var deferred = $.Deferred();
|
|
||||||
var url = OC.filePath(appName, 'l10n', OC.getLocale() + '.json');
|
var url = OC.filePath(appName, 'l10n', OC.getLocale() + '.json');
|
||||||
|
|
||||||
// load JSON translation bundle per AJAX
|
// load JSON translation bundle per AJAX
|
||||||
$.get(url,
|
return $.get(url)
|
||||||
function(result) {
|
.then(
|
||||||
if (result.translations) {
|
function(result) {
|
||||||
self.register(appName, result.translations, result.pluralForm);
|
if (result.translations) {
|
||||||
}
|
self.register(appName, result.translations, result.pluralForm);
|
||||||
if (callback) {
|
}
|
||||||
callback();
|
})
|
||||||
deferred.resolve();
|
.then(callback);
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return deferred.promise();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue