Internationalization (i18n) Testing
Setup and Prerequisites
Required Dependencies
npm install aurelia-i18n i18nextBasic I18n Configuration for Testing
import { I18N } from 'aurelia-i18n';
import Backend from 'i18next-xhr-backend';
class I18nTestHelper {
static configure(aurelia) {
const i18n = aurelia.container.get(I18N);
return i18n.setup({
backend: {
loadPath: 'locales/{{lng}}/{{ns}}.json'
},
lng: 'en',
attributes: ['t', 'i18n'],
fallbackLng: 'en',
debug: false
});
}
}Translation Testing Strategies
Testing Basic Translations
Testing Component with Translations
Formatting and Locale Testing
Number and Date Formatting
Pluralization Testing
Last updated
Was this helpful?