diff --git a/src/App.tsx b/src/App.tsx index 4d6ad89..565dd5d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,5 +1,6 @@ import React, { useEffect } from 'react'; import useStore from '@store/store'; +import i18n from './i18n'; import Chat from '@components/Chat'; import Menu from '@components/Menu'; @@ -16,6 +17,13 @@ function App() { const setApiKey = useStore((state) => state.setApiKey); const setCurrentChatIndex = useStore((state) => state.setCurrentChatIndex); + useEffect(() => { + document.documentElement.lang = i18n.language; + i18n.on('languageChanged', (lng) => { + document.documentElement.lang = lng; + }); + }, []); + useEffect(() => { // legacy local storage const oldChats = localStorage.getItem('chats');