mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
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
|