@epilot360/i18n
yarn add @epilot360/i18n
Translation and localisation library for the epilotepilot portal.
Uses i18next.
Usage​
// Component.jsx
import { useTranslation } from '@epilot360/i18n'
export const Component = () => {
const { t } = useTranslation('my-namespace')
return <h1>{t('hello_world_header', 'Hello World!')}</h1>
}
Translations are loaded asynchronously, so make sure to wrap your app inside <React.Suspense>
.
Adding Translations​
Translations are defined in static JSON locale files in epilot360-root-config.
The easiest way to translate epilot is to run the root-config project locally to see the changes immediately.
While running locally, missing translations will be automatically added to the locale files under locales/{locale}/{namespace}.json
.