Skip to main content

React integration (i18next)

info

To get full image of working i18next integration, check our React i18next Example Application.

For integration with React use standard React extension + we recommend also use ICU message formatter as that is supported on Tolgee platform natively:

npm install react-i18next i18next-icu

And then use following setup:

import { withTolgee } from '@tolgee/i18next';
import i18n from 'i18next';
import ICU from 'i18next-icu';
import { initReactI18next } from 'react-i18next';

withTolgee(i18n, {
apiUrl: process.env.REACT_APP_TOLGEE_API_URL,
apiKey: process.env.REACT_APP_TOLGEE_API_KEY,
})
.use(ICU)
.use(initReactI18next)
.init({
lng: 'en', // or use i18next language detector
supportedLngs: ['cs', 'en', 'fr', 'de'],
});

Now you can use regular react-i18next.