refactor: Change name of i18n and its usage in server

This commit is contained in:
Behnamrhp74 2025-03-08 21:04:46 +03:00
parent 1675d84cae
commit 38f0d0a596

View File

@ -10,7 +10,7 @@ export enum LANGS {
RU = "ru", RU = "ru",
} }
export const initI18next = async (params: { export const getI18n = async (params: {
lng: LANGS; lng: LANGS;
resources?: Resource; resources?: Resource;
ns?: string; ns?: string;
@ -43,13 +43,9 @@ export async function getServerTranslation(
ns?: string, ns?: string,
options: { keyPrefix?: string } = {}, options: { keyPrefix?: string } = {},
) { ) {
await initI18next({ lng }); const { i18n } = await getI18n({ lng });
return { return {
t: i18nInstance.getFixedT( t: i18n.getFixedT(lng, Array.isArray(ns) ? ns[0] : ns, options?.keyPrefix),
lng,
Array.isArray(ns) ? ns[0] : ns,
options?.keyPrefix,
),
i18n: i18nInstance, i18n: i18nInstance,
}; };
} }