Files
myeasycms-v2/packages/i18n/src/create-i18n-settings.ts
giancarlo 7cbbae9fef Remove Suspense from root-providers and refine route checks
The Suspense wrapper was removed from root-providers.tsx to simplify code. For the Privacy Path Checking, a property was added to 'AuthRedirectListener' to allow customization of 'privatePathPrefixes', and the prefixes list was moved to the top. Also, explicit constant assertions were added in 'create-i18n-settings.ts' to ensure the types correctness.
2024-04-21 19:53:16 +08:00

34 lines
599 B
TypeScript

/**
* Get i18n settings for i18next.
* @param languages
* @param language
* @param namespaces
*/
export function createI18nSettings({
languages,
language,
namespaces,
}: {
languages: string[];
language: string;
namespaces?: string | string[];
}) {
const lng = language;
const ns = namespaces;
return {
supportedLngs: languages,
fallbackLng: languages[0],
detection: undefined,
lng,
load: 'languageOnly' as const,
preload: false as const,
lowerCaseLng: true as const,
fallbackNS: ns,
ns,
react: {
useSuspense: true,
},
};
}