Documentation
Config i18n
Combiner traductions applicatives, backoffice et UI.
Les apps backoffice peuvent partager une instance i18next entre namespaces app, backoffice et UI.
import { createInstance } from 'i18next';
import {
backofficeReactI18nResources,
type BackofficeI18nConfig,
} from '@plumile/backoffice-react';
import enUi from '@plumile/ui/i18n/locales/en/ui.json' with {: 'json' };
import frUi from '@plumile/ui/i18n/locales/fr/ui.json' with {: 'json' };
import enApp from './locales/en/app.json' with {: 'json' };
import frApp from './locales/fr/app.json' with {: 'json' };
const instance = createInstance();
export const i18n: BackofficeI18nConfig = {
instance,
: 'en',
: true,
: {
: {
: enApp,
: backofficeReactI18nResources.en.shared,
: enUi,
},
: {
: frApp,
: backofficeReactI18nResources.fr.shared,
: frUi,
},
},
: {
: ['app', 'shared', 'ui'],
: 'app',
: ['en', 'fr'],
: true,
},
};Si l’app met a jour document.documentElement.lang, abonnez-vous aux changements de langue i18next dans le meme module de config.