Skip to content

Commit 9a09370

Browse files
committed
Refactor to use useLanguage hook for translations
Replaces direct calls to getTranslations and getUserLanguage with the useLanguage hook for managing translations in HomePage. This simplifies state management and ensures the hero title is dynamically translated.
1 parent aec37c4 commit 9a09370

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

app/page.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Button } from "@/components/ui/button"
66
import { Input } from "@/components/ui/input"
77
import Link from "next/link"
88
import Image from "next/image"
9-
import { getTranslations, getUserLanguage } from "@/lib/config"
9+
import { useLanguage } from "@/lib/config"
1010
import { useEffect, useState } from "react"
1111
import dynamic from "next/dynamic"
1212
import {
@@ -31,10 +31,10 @@ import {
3131
const LightRays = dynamic(() => import("@/components/light-rays"), { ssr: false })
3232

3333
export default function HomePage() {
34-
const [t, setT] = useState(getTranslations("en"))
34+
const { t } = useLanguage()
3535
const [typedText, setTypedText] = useState("")
3636
const [isTyping, setIsTyping] = useState(true)
37-
const fullText = "Think. Code. Test. Ship."
37+
const fullText = t.landing.hero.title || "Think. Code. Test. Ship."
3838

3939
// Logo animation state
4040
const technologies = [
@@ -51,10 +51,6 @@ export default function HomePage() {
5151
]
5252
const [currentTechIndex, setCurrentTechIndex] = useState(0)
5353

54-
useEffect(() => {
55-
setT(getTranslations(getUserLanguage()))
56-
}, [])
57-
5854
// Typing animation effect
5955
useEffect(() => {
6056
if (!isTyping) return

0 commit comments

Comments
 (0)