зеркало из https://github.com/github/docs.git
remove 'This aritlce is also available ...' when changing back to Eng… (#29868)
remove 'This aritlce is also available ...' when changing back to English
This commit is contained in:
Родитель
126b0a9f44
Коммит
1897eb1c94
|
@ -1,10 +1,12 @@
|
|||
import { useState, useEffect } from 'react'
|
||||
import Cookies from 'js-cookie'
|
||||
import { useRouter } from 'next/router'
|
||||
|
||||
import { languageKeys } from '../../lib/languages.js'
|
||||
import { PREFERRED_LOCALE_COOKIE_NAME } from '../../lib/constants.js'
|
||||
|
||||
export function useUserLanguage() {
|
||||
const { locale } = useRouter()
|
||||
const [userLanguage, setUserLanguage] = useState<string>('en')
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -22,7 +24,7 @@ export function useUserLanguage() {
|
|||
if (languagePreferred) {
|
||||
setUserLanguage(languagePreferred)
|
||||
}
|
||||
}, [])
|
||||
}, [locale])
|
||||
|
||||
return { userLanguage }
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче