Skip to content

Commit

Permalink
🐛 fix: 使用 client 加载 i18n 以解决 nextjs 集成问题 (lobehub#10)
Browse files Browse the repository at this point in the history
* 🐛 fix: 尝试使用原始 i18n 加载方式

* 🏷️ chore: fix type

* 🔥 chore: clean file

* ♻️ refactor: 清理项目,优化路径依赖关系

* 🚨 chore: fix lint
  • Loading branch information
arvinxx authored Jul 17, 2023
1 parent 1c047d6 commit 390ebfe
Show file tree
Hide file tree
Showing 32 changed files with 388 additions and 382 deletions.
19 changes: 0 additions & 19 deletions next-i18next.config.js

This file was deleted.

3 changes: 0 additions & 3 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import i18nConfig from './next-i18next.config.js';

const API_END_PORT_URL = process.env.API_END_PORT_URL || '';

/** @type {import('next').NextConfig} */
const nextConfig = {
i18n: i18nConfig.i18n,
reactStrictMode: true,
pageExtensions: ['page.tsx', 'api.ts'],
transpilePackages: ['@lobehub/ui', 'antd-style'],
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@
"lodash-es": "^4",
"lucide-react": "latest",
"nanoid": "^4",
"next": "^13",
"next-i18next": "^14",
"next": "13.4.7",
"openai-edge": "^1",
"polished": "^4",
"react": "^18",
Expand Down Expand Up @@ -110,15 +109,18 @@
"commitlint": "^17",
"eslint": "^8",
"husky": "^8",
"i18next-browser-languagedetector": "^7",
"i18next-resources-for-ts": "^1",
"jsdom": "^22",
"lint-staged": "^13",
"next-pwa": "^5",
"node-fetch": "^3",
"postcss-styled-syntax": "^0.4",
"prettier": "^2",
"remark": "^14",
"remark-cli": "^11",
"semantic-release": "^21",
"semantic-release-config-gitmoji": "^1",
"stylelint": "^15",
"typescript": "^5",
"vitest": "latest"
Expand Down
40 changes: 0 additions & 40 deletions public/locales/en_US/common.json

This file was deleted.

97 changes: 0 additions & 97 deletions public/locales/en_US/setting.json

This file was deleted.

40 changes: 0 additions & 40 deletions public/locales/zh_CN/common.json

This file was deleted.

98 changes: 0 additions & 98 deletions public/locales/zh_CN/setting.json

This file was deleted.

6 changes: 6 additions & 0 deletions src/layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@ import { useSessionStore } from '@/store/session';
import { useSettings } from '@/store/settings';
import { GlobalStyle } from '@/styles';

import i18n from '../locales';
import { useStyles } from './style';

const Layout = ({ children }: PropsWithChildren) => {
const { styles } = useStyles();

useEffect(() => {
// 用一种比较奇怪的方式import 了 18n
i18n.finally(() => {});
}, []);

return (
<ConfigProvider locale={Zh_CN}>
<App className={styles.bg}>{children}</App>
Expand Down
Loading

0 comments on commit 390ebfe

Please sign in to comment.