Update language files and fix UI issues
This commit is contained in:
17
src/hooks/useI18n.tsx
Normal file
17
src/hooks/useI18n.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import { supportLanguage } from "@/i18n/support-language"
|
||||
import { useState } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
export const useI18n = () => {
|
||||
const { i18n } = useTranslation()
|
||||
const [locale, setLocale] = useState<string>(
|
||||
localStorage.getItem("i18nextLng") || "en"
|
||||
)
|
||||
|
||||
const changeLocale = (lang: string) => {
|
||||
setLocale(lang)
|
||||
i18n.changeLanguage(lang)
|
||||
}
|
||||
|
||||
return { locale, changeLocale, supportLanguage }
|
||||
}
|
||||
Reference in New Issue
Block a user