Skip to content

Commit 8ecd401

Browse files
✨ feat: Add fallback language, modify React suspense settings, enable strict mode, and update dependencies
The changes include modifying the configuration file, package.json file, and several page files. The fallback language is added, React suspense is disabled, strict mode is enabled, and dependencies are updated. The getStaticProps function in index.page.tsx is replaced with getServerSideProps.
1 parent 853f18a commit 8ecd401

File tree

5 files changed

+21
-15
lines changed

5 files changed

+21
-15
lines changed

next-i18next.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@ const i18n = require('./.i18nrc');
33
/** @type {import('next-i18next').UserConfig} */
44
module.exports = {
55
debug: process.env.NODE_ENV === 'development',
6+
fallbackLng: {
7+
default: ['en'],
8+
zh_TW: ['zh_CN'],
9+
},
610
i18n: {
711
defaultLocale: i18n.entryLocale,
812
locales: [i18n.entryLocale, ...i18n.outputLocales],
913
},
14+
react: { useSuspense: false },
15+
reloadOnPrerender: process.env.NODE_ENV === 'development',
16+
strictMode: true,
1017
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"@ant-design/colors": "^7",
6262
"@ant-design/icons": "^5",
6363
"@commitlint/cli": "^17",
64-
"@lobehub/ui": "^1",
64+
"@lobehub/ui": "lastest",
6565
"@vercel/analytics": "^1",
6666
"ahooks": "^3",
6767
"antd": "^5",

src/pages/chat/[id].page.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import isEqual from 'fast-deep-equal';
2+
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
23
import Head from 'next/head';
34
import { useRouter } from 'next/router';
45
import { memo, useEffect } from 'react';
@@ -56,4 +57,14 @@ const ChatLayout = () => {
5657
);
5758
};
5859

60+
export async function getServerSideProps(context: any) {
61+
const { locale } = context;
62+
return {
63+
props: {
64+
// pass the translation props to the page component
65+
...(await serverSideTranslations(locale)),
66+
},
67+
};
68+
}
69+
5970
export default memo(ChatLayout);

src/pages/chat/index.page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { default } from './[id].page';
1+
export { default, getServerSideProps } from './[id].page';

src/pages/index.page.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1 @@
1-
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
2-
3-
export { default } from './chat/index.page';
4-
5-
export async function getStaticProps(context: any) {
6-
const { locale } = context;
7-
return {
8-
props: {
9-
// pass the translation props to the page component
10-
...(await serverSideTranslations(locale)),
11-
},
12-
};
13-
}
1+
export { default, getServerSideProps } from './chat/index.page';

0 commit comments

Comments
 (0)