Perf: i18n ns (#1441)

* i18n

* fix: handle
This commit is contained in:
Archer
2024-05-10 18:41:41 +08:00
committed by GitHub
parent f351d4ea68
commit 26f4c92124
27 changed files with 1705 additions and 1595 deletions

View File

@@ -1,3 +1,4 @@
import { I18nNsType } from '@/types/i18n';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
export const LANG_KEY = 'NEXT_LOCALE_LANG';
@@ -16,8 +17,8 @@ export const langMap = {
}
};
export const serviceSideProps = (content: any) => {
return serverSideTranslations(content.locale, undefined, null, content.locales);
export const serviceSideProps = (content: any, ns: I18nNsType = []) => {
return serverSideTranslations(content.locale, ['common', ...ns], null, content.locales);
};
export const getLng = (lng: string) => {