aboutsummaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-11-19 14:49:15 +0100
committerVincent Petry <pvince81@owncloud.com>2014-11-19 14:49:15 +0100
commit1c5933c96cd68f353165a02a76dd47760e8d493e (patch)
treef8ca560941e8c9df43d175575abf6f9466725203 /core/js
parentcd60a27ad671b0e2c5dc117436836da012e0d13e (diff)
downloadnextcloud-server-1c5933c96cd68f353165a02a76dd47760e8d493e.tar.gz
nextcloud-server-1c5933c96cd68f353165a02a76dd47760e8d493e.zip
Better use of promise in OC.L10N.load()
Diffstat (limited to 'core/js')
-rw-r--r--core/js/l10n.js21
1 files changed, 8 insertions, 13 deletions
diff --git a/core/js/l10n.js b/core/js/l10n.js
index 2db4609ded2..3e37da01369 100644
--- a/core/js/l10n.js
+++ b/core/js/l10n.js
@@ -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);
},
/**