Skip to content

Commit 4c688ff

Browse files
authored
fix: config doc i18n (#97)
1 parent 3df8977 commit 4c688ff

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

packages/components/docs/docs/theme/index.tsx

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@ import React, { useEffect } from 'react';
22

33
import Theme from 'rspress/theme';
44
import { useDark, useLocation } from 'rspress/runtime';
5-
import { Button } from '@douyinfe/semi-ui';
5+
import { Button, LocaleProvider } from '@douyinfe/semi-ui';
6+
import { zh_CN, en_US } from '@coze-arch/coze-design/locales';
7+
import { CDLocaleProvider, zhCN, enUS } from '@coze-arch/coze-design';
68
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- 保证css样式顺序和bot一致
79
const a = Button;
810

911
// 以下展示所有的 Props
1012
const Layout = () => {
1113
// for semi dark mode
1214
const dark = useDark();
15+
16+
const currentLocale = navigator.language ?? 'en-US';
17+
1318
useEffect(() => {
1419
if (dark) {
1520
document.body.setAttribute('theme-mode', 'dark');
@@ -21,15 +26,19 @@ const Layout = () => {
2126
const { pathname } = useLocation();
2227

2328
return (
24-
<Theme.Layout
25-
bottom={
26-
pathname.startsWith('/resource/') ? (
27-
<div className="text-xs text-gray-500 text-center p-1">
28-
部分内容为AI自动生成,注意甄别,如有错误请及时反馈
29-
</div>
30-
) : null
31-
}
32-
/>
29+
<CDLocaleProvider locale={currentLocale === 'en-US' ? en_US : zh_CN}>
30+
<LocaleProvider locale={currentLocale === 'en-US' ? enUS : zhCN}>
31+
<Theme.Layout
32+
bottom={
33+
pathname.startsWith('/resource/') ? (
34+
<div className="text-xs text-gray-500 text-center p-1">
35+
部分内容为AI自动生成,注意甄别,如有错误请及时反馈
36+
</div>
37+
) : null
38+
}
39+
/>
40+
</LocaleProvider>
41+
</CDLocaleProvider>
3342
);
3443
};
3544

0 commit comments

Comments
 (0)