mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-01 10:01:12 +01:00
added test for plugin-included translations, /cc @pitaj
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user