Documentation
I18n config
Combine app translations with shared backoffice and UI translation resources.
Backoffice apps can share one i18next instance across app, backoffice, and UI namespaces.
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,
},
};If the app updates document.documentElement.lang, subscribe to i18next language changes in the same config module.