mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-31 12:51:35 +02:00
Delay Settings Page Content Until Translations Are Ready GitOrigin-RevId: 0537367f672bd2e88c95248d15c5638887ff3aee
21 lines
466 B
TypeScript
21 lines
466 B
TypeScript
import { useEffect, useState } from 'react'
|
|
import i18n from '../../../js/i18n'
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
function useWaitForI18n() {
|
|
const { ready: isHookReady } = useTranslation()
|
|
const [isLocaleDataLoaded, setIsLocaleDataLoaded] = useState(false)
|
|
|
|
useEffect(() => {
|
|
i18n.then(() => {
|
|
setIsLocaleDataLoaded(true)
|
|
})
|
|
}, [])
|
|
|
|
return {
|
|
isReady: isHookReady && isLocaleDataLoaded,
|
|
}
|
|
}
|
|
|
|
export default useWaitForI18n
|