fix i18n runtime scoping for SSR requests
Create a dedicated i18next instance per SSR request and remove server context-storage coupling from translation runtime, while keeping a separate client singleton path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { i18n as I18nInstance } from 'i18next';
|
||||
|
||||
import { getActiveI18nInstance } from '@/lib/translation';
|
||||
import { getClientI18nInstance } from '@/lib/translation/client';
|
||||
|
||||
import { defaultLocale, supportedLocales, type SupportedLocale } from './constants';
|
||||
|
||||
@@ -15,5 +15,5 @@ export const normalizeLocale = (locale?: string): SupportedLocale => {
|
||||
};
|
||||
|
||||
export const getActiveI18n = (): I18nInstance | undefined => {
|
||||
return getActiveI18nInstance();
|
||||
return import.meta.env.SSR ? undefined : getClientI18nInstance();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user