@@ -2,8 +2,10 @@ import React, { useEffect, useRef, useState, lazy, Suspense } from 'react';
2
2
import { BrowserRouter , Routes , Navigate , Route , useLocation , useNavigate , Outlet } from 'react-router-dom' ;
3
3
import Loading from 'tdesign-react/loading' ;
4
4
import ConfigProvider from 'tdesign-react/config-provider' ;
5
- // import locale from 'tdesign-react/locale/zh_CN';
6
- // import locale from 'tdesign-react/locale/en_US';
5
+ import zhConfig from 'tdesign-react/es/locale/zh_CN' ;
6
+ import enConfig from 'tdesign-react/es/locale/en_US' ;
7
+ import { getLang } from 'tdesign-site-components' ;
8
+
7
9
import siteConfig from '../site.config' ;
8
10
import { getRoute , filterVersions } from './utils' ;
9
11
import packageJson from '@/package.json' ;
@@ -48,6 +50,7 @@ function Components() {
48
50
const tdDocSearch = useRef ( ) ;
49
51
50
52
const [ version ] = useState ( currentVersion ) ;
53
+ const [ globalConfig ] = useState ( getLang ( ) === 'en' ? enConfig : zhConfig ) ;
51
54
52
55
function initHistoryVersions ( ) {
53
56
fetch ( registryUrl )
@@ -92,14 +95,15 @@ function Components() {
92
95
} ;
93
96
94
97
initHistoryVersions ( ) ;
98
+
95
99
} , [ ] ) ;
96
100
97
101
useEffect ( ( ) => {
98
102
document . querySelector ( 'td-stats' ) ?. track ?. ( ) ;
99
103
} , [ location ] ) ;
100
104
101
105
return (
102
- < ConfigProvider /* globalConfig={{ animation: { exclude: ['ripple'] }}} */ >
106
+ < ConfigProvider globalConfig = { globalConfig } >
103
107
< td-doc-layout >
104
108
< td-header ref = { tdHeaderRef } slot = "header" >
105
109
< td-doc-search slot = "search" ref = { tdDocSearch } />
0 commit comments