File tree Expand file tree Collapse file tree 1 file changed +19
-10
lines changed
packages/components/docs/docs/theme Expand file tree Collapse file tree 1 file changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -2,14 +2,19 @@ import React, { useEffect } from 'react';
2
2
3
3
import Theme from 'rspress/theme' ;
4
4
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' ;
6
8
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- 保证css样式顺序和bot一致
7
9
const a = Button ;
8
10
9
11
// 以下展示所有的 Props
10
12
const Layout = ( ) => {
11
13
// for semi dark mode
12
14
const dark = useDark ( ) ;
15
+
16
+ const currentLocale = navigator . language ?? 'en-US' ;
17
+
13
18
useEffect ( ( ) => {
14
19
if ( dark ) {
15
20
document . body . setAttribute ( 'theme-mode' , 'dark' ) ;
@@ -21,15 +26,19 @@ const Layout = () => {
21
26
const { pathname } = useLocation ( ) ;
22
27
23
28
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 >
33
42
) ;
34
43
} ;
35
44
You can’t perform that action at this time.
0 commit comments