mirror of
https://github.com/lobehub/lobehub.git
synced 2026-03-26 13:19:34 +07:00
✨ 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.
This commit is contained in:
@@ -3,8 +3,15 @@ const i18n = require('./.i18nrc');
|
||||
/** @type {import('next-i18next').UserConfig} */
|
||||
module.exports = {
|
||||
debug: process.env.NODE_ENV === 'development',
|
||||
fallbackLng: {
|
||||
default: ['en'],
|
||||
zh_TW: ['zh_CN'],
|
||||
},
|
||||
i18n: {
|
||||
defaultLocale: i18n.entryLocale,
|
||||
locales: [i18n.entryLocale, ...i18n.outputLocales],
|
||||
},
|
||||
react: { useSuspense: false },
|
||||
reloadOnPrerender: process.env.NODE_ENV === 'development',
|
||||
strictMode: true,
|
||||
};
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
"@ant-design/colors": "^7",
|
||||
"@ant-design/icons": "^5",
|
||||
"@commitlint/cli": "^17",
|
||||
"@lobehub/ui": "^1",
|
||||
"@lobehub/ui": "lastest",
|
||||
"@vercel/analytics": "^1",
|
||||
"ahooks": "^3",
|
||||
"antd": "^5",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import isEqual from 'fast-deep-equal';
|
||||
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
|
||||
import Head from 'next/head';
|
||||
import { useRouter } from 'next/router';
|
||||
import { memo, useEffect } from 'react';
|
||||
@@ -56,4 +57,14 @@ const ChatLayout = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export async function getServerSideProps(context: any) {
|
||||
const { locale } = context;
|
||||
return {
|
||||
props: {
|
||||
// pass the translation props to the page component
|
||||
...(await serverSideTranslations(locale)),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default memo(ChatLayout);
|
||||
|
||||
@@ -1 +1 @@
|
||||
export { default } from './[id].page';
|
||||
export { default, getServerSideProps } from './[id].page';
|
||||
|
||||
@@ -1,13 +1 @@
|
||||
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
|
||||
|
||||
export { default } from './chat/index.page';
|
||||
|
||||
export async function getStaticProps(context: any) {
|
||||
const { locale } = context;
|
||||
return {
|
||||
props: {
|
||||
// pass the translation props to the page component
|
||||
...(await serverSideTranslations(locale)),
|
||||
},
|
||||
};
|
||||
}
|
||||
export { default, getServerSideProps } from './chat/index.page';
|
||||
|
||||
Reference in New Issue
Block a user