@@ -47,6 +47,7 @@ import { downloadFile } from 'app/utils/fetch';
4747import { BASE_RESOURCE_URL } from 'globalConstants' ;
4848import { changeLang } from 'locales/i18n' ;
4949import React , { cloneElement , useCallback , useMemo , useState } from 'react' ;
50+ import { useTranslation } from 'react-i18next' ;
5051import { useDispatch , useSelector } from 'react-redux' ;
5152import { NavLink , useHistory , useRouteMatch } from 'react-router-dom' ;
5253import styled from 'styled-components/macro' ;
@@ -84,6 +85,7 @@ export function Navbar() {
8485 const [ modifyPasswordVisible , setModifyPasswordVisible ] = useState ( false ) ;
8586 const dispatch = useDispatch ( ) ;
8687 const history = useHistory ( ) ;
88+ const { i18n } = useTranslation ( ) ;
8789 const systemInfo = useSelector ( selectSystemInfo ) ;
8890 const orgId = useSelector ( selectOrgId ) ;
8991 const currentOrganization = useSelector ( selectCurrentOrganization ) ;
@@ -228,7 +230,9 @@ export function Navbar() {
228230 break ;
229231 case 'zh' :
230232 case 'en' :
231- changeLang ( key ) ;
233+ if ( i18n . language !== key ) {
234+ changeLang ( key ) ;
235+ }
232236 break ;
233237 case 'dark' :
234238 case 'light' :
@@ -238,7 +242,7 @@ export function Navbar() {
238242 break ;
239243 }
240244 } ,
241- [ dispatch , history , handleChangeThemeFn ] ,
245+ [ dispatch , history , i18n , handleChangeThemeFn ] ,
242246 ) ;
243247
244248 const onSetPolling = useCallback (
0 commit comments