diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-11-20 10:53:46 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-11-20 10:53:46 +0100 |
commit | 10d0883da9fdaab5c13bb9dd52f7fb180310a5bc (patch) | |
tree | d56175d3e6657411625f63f7e2fc91b64a79e3c4 /core/js/js.js | |
parent | fffc5bc002133d6b3ee9c2dbe50a5044db83ede0 (diff) | |
parent | ffe57d89e425771a5c027a3484d772319919d15d (diff) | |
download | nextcloud-server-10d0883da9fdaab5c13bb9dd52f7fb180310a5bc.tar.gz nextcloud-server-10d0883da9fdaab5c13bb9dd52f7fb180310a5bc.zip |
Merge pull request #12257 from owncloud/l10n-loadtranslationsfromjs
Added function to load translations from JS
Diffstat (limited to 'core/js/js.js')
-rw-r--r-- | core/js/js.js | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/core/js/js.js b/core/js/js.js index 39e382b544b..eb2f10b51f0 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -253,6 +253,17 @@ var OC={ }, /** + * Loads translations for the given app asynchronously. + * + * @param {String} app app name + * @param {Function} callback callback to call after loading + * @return {Promise} + */ + addTranslations: function(app, callback) { + return OC.L10N.load(app, callback); + }, + + /** * Returns the base name of the given path. * For example for "/abc/somefile.txt" it will return "somefile.txt" * @@ -475,6 +486,15 @@ var OC={ return window.matchMedia(media); } return false; + }, + + /** + * Returns the user's locale + * + * @return {String} locale string + */ + getLocale: function() { + return $('html').prop('lang'); } }; @@ -869,9 +889,9 @@ function object(o) { function initCore() { /** - * Set users local to moment.js as soon as possible + * Set users locale to moment.js as soon as possible */ - moment.locale($('html').prop('lang')); + moment.locale(OC.getLocale()); /** |