@nextinq/i18n
Base i18n utils
Installation
yarn add @nextinq/i18n
Usage
- Setup: Run on app start-up
import { initLocale } from '@nextinq/i18n';
// Phrases can be loaded from server, bundled with app, ...
import { csPhrases } from './locales/cs';
// Example phrases: csPhrases = { "hello": "Ahoj", "cancel": "Zrušit" };
initLocale({
locale: 'cs',
phrases: csPhrases,
});
- Translation. Function t has the same features as in Polyglot.js t function
import { t } from '@nextinq/i18n';
const greeting = t('hello') // => 'Ahoj'
Development
Test
yarn test
CI/CD
See Github actions
NPN Publish Setup
In order to publish packages to npmjs.org or to Github Registry you should add npm_token and/or github_token in Settings -> Secrets
of the current project