Ghost/ghost/i18n/test/i18n.test.js
Daniel Lockyer 6d8ca23625
Added support for namespaces to i18n package
refs https://github.com/TryGhost/Ghost/issues/15502

- this adds support for namespaces to the i18n package so we can
  separate translations for different packages
2023-03-01 10:24:08 +01:00

46 lines
1.1 KiB
JavaScript

const assert = require('assert');
const i18n = require('../');
describe('i18n', function () {
describe('Can use Portal resources', function () {
describe('English', function () {
let t;
before(function () {
t = i18n('nl', 'portal').t;
});
it('can translate `Name`', function () {
assert.equal(t('Name'), 'Naam');
});
});
});
describe('Can translate', function () {
describe('Dutch', function () {
let t;
before(function () {
t = i18n('nl', 'test').t;
});
it('can translate Dutch', function () {
assert.equal(t('Hello'), 'Hallo Test');
});
});
describe('English', function () {
let t;
before(function () {
t = i18n('en', 'test').t;
});
it('can translate English', function () {
assert.equal(t('Hello'), 'Hello Test');
});
});
});
});