Files
myeasycms-v2/packages/i18n/src/create-i18n-settings.ts
Giancarlo Buomprisco 7a1903d0c2 Links prefetching (#225)
1. Marketing Layout: speed up rendering by retrieving user session from cookies instead of using server side request
2. Use "redirecting" state when signing in to keep displaying a loading state while Next.js redirects to home page
3. Use "useCallback" to prevent double tracking when switching pages
4. Add links pre-fetching in marketing navigation
5. Add new pending state to MFA verification form
6. Pre-fetch sign-in/sign-up pages
7. Fix i18n when using regional languages
8. currency formatter should default to the region if it exists
9. Update packages
2025-03-31 11:06:37 +08:00

42 lines
808 B
TypeScript

import type { InitOptions } from 'i18next';
/**
* Get i18n settings for i18next.
* @param languages
* @param language
* @param namespaces
*/
export function createI18nSettings({
languages,
language,
namespaces,
}: {
languages: string[];
language: string;
namespaces?: string | string[];
}): InitOptions {
const lng = language;
const ns = namespaces;
return {
supportedLngs: languages,
fallbackLng: languages[0],
detection: undefined,
lng,
preload: false as const,
lowerCaseLng: true as const,
fallbackNS: ns,
missingInterpolationHandler: (text, value, options) => {
console.debug(
`Missing interpolation value for key: ${text}`,
value,
options,
);
},
ns,
react: {
useSuspense: true,
},
};
}