4fcaabe563
closes https://github.com/TryGhost/Team/issues/3307 This commit includes several important updates to add internationalisation (i18n) support within the signup form package: - Modified the translate script in `package.json` to include translations for the signup form. - Added a new test for the signup form resources in `i18n.test.js`. - Updated `tsconfig.json` to allow synthetic default imports. - Made updates to `package.json`, including adding a prebuild command for `@tryghost/i18n` to ensure typescript declaration files get built. - added `vite-plugin-commonjs` so we can bundle commonjs packages to be useable by the browser. - In `App.tsx`, imported the `i18n` library and created an `i18n` instance for the `signup-form` namespace. This `i18n` instance's `t` function was added to the application context. - Updated the `AppContextType` in `AppContext.ts` to include the `t` function from i18n Co-authored-by: Daniel Lockyer <hi@daniellockyer.com>
34 lines
858 B
JavaScript
34 lines
858 B
JavaScript
const assert = require('assert');
|
|
|
|
const i18n = require('../');
|
|
|
|
describe('i18n', function () {
|
|
describe('Can use Portal resources', function () {
|
|
describe('Dutch', function () {
|
|
let t;
|
|
|
|
before(function () {
|
|
t = i18n('nl', 'portal').t;
|
|
});
|
|
|
|
it('can translate `Name`', function () {
|
|
assert.equal(t('Name'), 'Naam');
|
|
});
|
|
});
|
|
});
|
|
|
|
describe('Can use Signup-form resources', function () {
|
|
describe('Afrikaans', function () {
|
|
let t;
|
|
|
|
before(function () {
|
|
t = i18n('af', 'signup-form').t;
|
|
});
|
|
|
|
it('can translate `Now check your email!`', function () {
|
|
assert.equal(t('Now check your email!'), 'Nou kyk na u e-pos!');
|
|
});
|
|
});
|
|
});
|
|
});
|