diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-02-29 19:39:21 +0300 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-02-29 19:39:21 +0300 |
commit | 0091df2bc8eed432df9d726d5bea09ac527128d2 (patch) | |
tree | 65dd8ede996c1776d6eea666342cc8106db0c6b7 /core | |
parent | 78570a5f728bb0b16ddea31f8ca8cfc212144246 (diff) |
Improved JS L10N bundle merging + tests
Diffstat (limited to 'core')
-rw-r--r-- | core/js/l10n.js | 4 | ||||
-rw-r--r-- | core/js/tests/specs/l10nSpec.js | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/core/js/l10n.js b/core/js/l10n.js index c19f523b30e..43cfc7e820f 100644 --- a/core/js/l10n.js +++ b/core/js/l10n.js @@ -78,9 +78,7 @@ OC.L10N = { } } else { // Theme overwriting the default language - _.each(bundle, function(translation, key) { - self._bundles[appName][key] = translation - }); + _.extend(self._bundles[appName], bundle); } }, diff --git a/core/js/tests/specs/l10nSpec.js b/core/js/tests/specs/l10nSpec.js index bafc7746d6c..2ceb2f4a916 100644 --- a/core/js/tests/specs/l10nSpec.js +++ b/core/js/tests/specs/l10nSpec.js @@ -52,6 +52,14 @@ describe('OC.L10N tests', function() { t(TEST_APP, 'Hello {name}', {name: '<strong>Steve</strong>'}, null, {escape: false}) ).toEqual('Hello <strong>Steve</strong>'); }); + it('keeps old texts when registering existing bundle', function() { + OC.L10N.register(TEST_APP, { + 'sunny': 'sonnig', + 'new': 'neu' + }); + expect(t(TEST_APP, 'sunny')).toEqual('sonnig'); + expect(t(TEST_APP, 'new')).toEqual('neu'); + }); }); describe('plurals', function() { function checkPlurals() { |