wealth/apps/bear/src/i18n/i18n.ts

28 lines
793 B
TypeScript

import {
DEFAULT_LOCALE,
DEFAULT_NAMESPACE,
NAMESPACES,
resources,
} from '@lumina/market/shared/locales';
import { createInstance } from 'i18next';
import type { i18n as I18n } from 'i18next';
/**
* The app's i18n instance. One Persian locale with resources bundled in, so it initialises
* synchronously and holds nothing per request. Server components read it directly; client code
* imports it through `i18n.client`, which binds it to react-i18next (React context can't load in
* a server component).
*/
export const i18n: I18n = createInstance();
void i18n.init({
lng: DEFAULT_LOCALE,
fallbackLng: DEFAULT_LOCALE,
resources,
ns: NAMESPACES,
defaultNS: DEFAULT_NAMESPACE,
initAsync: false,
// React escapes already.
interpolation: { escapeValue: false },
});