From ef6e72c2469402d4a6d4f8c4e150fb940d828d25 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 12 Sep 2016 11:23:19 -0400 Subject: [PATCH] added test for plugin-included translations, /cc @pitaj --- tests/translator.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/translator.js b/tests/translator.js index 7546ec1d90..a86e5b9018 100644 --- a/tests/translator.js +++ b/tests/translator.js @@ -4,6 +4,7 @@ var assert = require('assert'); var translator = require('../public/src/modules/translator.js'); +var plugins = require('../src/plugins'); describe('Translator', function(){ describe('.translate()', function(){ @@ -95,5 +96,18 @@ describe('Translator', function(){ }); }); + it('should properly handle translations added by plugins', function(done) { + plugins.customLanguages = { + 'en_GB/myplugin.json': { + 'foo': 'bar', + 'bar': 'baz, and %1' + } + }; + + translator.translate('[[myplugin:foo]], [[myplugin:bar, quux]]', function(translated) { + assert.strictEqual(translated, 'bar, baz, and quux'); + done(); + }); + }); }); });