Enhanced error handling in documentation and blog pages, to ensure smoother running and user experience. This also includes additional UI updates related to font selection, layout arrangement, and interactive elements on error pages, marketing pages, and general site navigation components. Moreover, a "contact us" feature has been added to error pages to help users seek assistance more conveniently.
43 lines
843 B
TypeScript
43 lines
843 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,
|
|
load: 'languageOnly' as const,
|
|
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,
|
|
},
|
|
};
|
|
}
|