How to use the @aurelia/i18n.Signals.I18N_EA_CHANNEL function in @aurelia/i18n

To help you get started, we’ve selected a few @aurelia/i18n examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aurelia / aurelia / packages / __tests__ / i18n / i18n.spec.ts View on Github external
it('setLocale changes the active language of i18next', async function () {
    const { sut, eaSpy, mockSignaler } = await createFixture();

    await sut.setLocale('de');

    eaSpy.methodCalledOnceWith('publish', [Signals.I18N_EA_CHANNEL, { newLocale: 'de', oldLocale: 'en' }]);
    const dispatchCall = mockSignaler.calls.find((call) => call[0] === 'dispatchSignal');
    assert.notEqual(dispatchCall, undefined);
    const [, args] = dispatchCall;
    assert.deepEqual(args, Signals.I18N_SIGNAL);
    assert.equal(sut.getLocale(), 'de');
  });