From fcd25d3d45c2261b33d655c37efcff557fd2e3b4 Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Thu, 25 Dec 2025 19:34:42 +0800 Subject: [PATCH] load on server --- web/i18n-config/server.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/web/i18n-config/server.ts b/web/i18n-config/server.ts index 31f3afde46..1586ea1a8e 100644 --- a/web/i18n-config/server.ts +++ b/web/i18n-config/server.ts @@ -11,18 +11,16 @@ import { i18n } from '.' // https://locize.com/blog/next-13-app-dir-i18n/ const initI18next = async (lng: Locale, ns: Namespace) => { - const camelNs = camelCase(ns) as KeyPrefix const i18nInstance = createInstance() await i18nInstance .use(initReactI18next) .use(resourcesToBackend((language: Locale, namespace: string) => { - const kebabNs = namespace.replace(/[A-Z]/g, m => `-${m.toLowerCase()}`) - return import(`../i18n/${language}/${kebabNs}.json`) + return import(`../i18n/${language}/${namespace}.json`) })) .init({ lng: lng === 'zh-Hans' ? 'zh-Hans' : lng, - ns: camelNs, - defaultNS: camelNs, + ns, + defaultNS: ns, fallbackLng: 'en-US', }) return i18nInstance