initial commit
This commit is contained in:
15
src/hooks/useTranslation.ts
Normal file
15
src/hooks/useTranslation.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { useLanguage } from "../components/LanguageProvider"
|
||||
import { en } from "../locales/en"
|
||||
import { fa } from "../locales/fa"
|
||||
|
||||
const dictionaries = { en, fa }
|
||||
|
||||
export function useTranslation() {
|
||||
const { language, setLanguage } = useLanguage()
|
||||
|
||||
return {
|
||||
t: dictionaries[language],
|
||||
lang: language,
|
||||
setLanguage
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user