Skip to content

Commit b4d2fc4

Browse files
authored
feat: add english locale data using next-intl
feat: add english locale data using next-intl
2 parents 3a531e7 + 7f809bf commit b4d2fc4

File tree

11 files changed

+165
-42
lines changed

11 files changed

+165
-42
lines changed

src/components/common/footer/Footer.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ import { dataFooter } from "./constants";
33
import { Link } from "@/lib/navigation";
44
import Image from "next/image";
55
import { Button } from "@/components/ui/button";
6+
import { useTranslations } from "next-intl";
67

78
const Footer = () => {
89
const date = new Date();
910
const { resource, social_media, contact } = dataFooter;
11+
12+
const t = useTranslations("Footer");
13+
1014
return (
1115
<>
1216
<div className="space-y-8 border-t border-dashed">
@@ -16,23 +20,23 @@ const Footer = () => {
1620

1721
{/* Resources */}
1822
<div className="flex flex-col md:items-start items-center gap-3">
19-
<h3 className="text-lg text-hmc-primary font-semibold">{resource.title}</h3>
23+
<h3 className="text-lg text-hmc-primary font-semibold">{t("resource.title")}</h3>
2024
<div className="flex flex-col md:items-start items-center gap-1">
21-
{resource.data.map((data) => (
25+
{resource.data.map((data, index) => (
2226
<Link
2327
key={data.navigate_url}
2428
href={data.navigate_url}
2529
className="md:text-sm text-xs text-slate-600 dark:text-slate-400 hover:opacity-80 hover:underline"
2630
>
27-
{data.name}
31+
{t(`resource.data.${index}.name`)}
2832
</Link>
2933
))}
3034
</div>
3135
</div>
3236

3337
{/* Social Media */}
3438
<div className="flex flex-col md:items-start items-center gap-3">
35-
<h3 className="text-lg text-hmc-primary font-semibold">{social_media.title}</h3>
39+
<h3 className="text-lg text-hmc-primary font-semibold">{t("social_media.title")}</h3>
3640
<div className="flex flex-col md:items-start items-center gap-1">
3741
{social_media.data.map((data) => (
3842
<Link
@@ -48,7 +52,7 @@ const Footer = () => {
4852

4953
{/* Contact */}
5054
<div className="flex flex-col md:items-start items-center gap-3">
51-
<h3 className="text-lg text-hmc-primary font-semibold">{contact.title}</h3>
55+
<h3 className="text-lg text-hmc-primary font-semibold">{t("contact.title")}</h3>
5256
<div className="flex flex-col md:items-start items-center gap-1">
5357
{contact.data.map((data) => (
5458
<Button
@@ -66,7 +70,9 @@ const Footer = () => {
6670
</div>
6771
</div>
6872
<footer className="bg-slate-950 dark:bg-slate-950 p-8">
69-
<p className="text-center text-white">{date.getFullYear()} © Penggiat Teknologi Palu Berkarya</p>
73+
<p className="md:text-sm text-xs text-center text-white">
74+
{date.getFullYear()} © Penggiat Teknologi Palu Berkarya
75+
</p>
7076
</footer>
7177
</>
7278
);

src/features/home/components/AboutSection.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import { Button } from "@/components/ui/button";
22
import { Link } from "@/lib/navigation";
33
import { ArrowRight } from "lucide-react";
4+
import { useTranslations } from "next-intl";
45
import Image from "next/image";
56

67
const AboutSection = () => {
8+
const t = useTranslations("HomePage.section-about");
9+
710
return (
811
<div className="container lg:py-40 py-10">
912
<div className="flex lg:flex-row flex-col-reverse lg:gap-16 gap-10">
@@ -32,18 +35,19 @@ const AboutSection = () => {
3235
</div>
3336
<div className="basis-1/2 gap-4 lg:-mt-16">
3437
<div className="flex flex-col lg:items-end gap-4">
35-
<h2 className="text-tertiary md:text-3xl text-2xl font-bold">Siapa Kami? 🤔</h2>
38+
<h2 className="text-tertiary md:text-3xl text-2xl font-bold">{t("title")}</h2>
3639
<h1 className="text-hmc-primary lg:text-right md:text-5xl text-3xl font-bold md:leading-[60px]">
37-
Komunitas Untuk Memajukan Daerah.
40+
{t("sub-title")}
3841
</h1>
3942
<div className="flex flex-col lg:items-end gap-3">
4043
<p className="md:text-base lg:text-right text-sm text-slate-500 dark:text-slate-400 md:leading-7">
41-
<b>Hammercode</b> adalah sebuah komunitas teknologi yang diinisiasi sebagai wadah berkumpulnya para
42-
pembelajar, programmer, dan pelaku industri teknologi lainnya yang berada di kota Palu dan sekitarnya.
44+
{t.rich("description", {
45+
b: (chunks) => <b>{chunks}</b>,
46+
})}
4347
</p>
4448
<Button variant="tertiary" asChild className="flex items-center gap-2 w-fit">
4549
<Link href="/about">
46-
View More <ArrowRight className="lg:w-6 w-5" />
50+
{t("view-more-button")} <ArrowRight className="lg:w-6 w-5" />
4751
</Link>
4852
</Button>
4953
</div>

src/features/home/components/CourseSection.tsx renamed to src/features/home/components/ClassSection.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@ import Image from "next/image";
22
import { courseData } from "../constants";
33
import { Carousel, CarouselContent, CarouselItem } from "@/components/ui/carousel";
44
import { Card, CardContent, CardHeader } from "@/components/ui/card";
5+
import { useTranslations } from "next-intl";
56

67
const ClassSection = () => {
8+
const t = useTranslations("HomePage.section-class");
9+
710
return (
811
<div className="bg-sky-50 dark:bg-slate-900">
912
<div className="container md:py-14 py-10 my-10 space-y-6">
1013
<div className="flex flex-col items-center gap-2">
11-
<h2 className="text-tertiary md:text-3xl text-2xl font-bold">Kelas Hammercode 🔥</h2>
14+
<h2 className="text-tertiary md:text-3xl text-2xl font-bold">{t("title")}</h2>
1215
<p className="max-w-3xl md:text-base text-center text-sm text-slate-500 dark:text-slate-400 md:leading-7">
13-
Hammercode tempat yang cocok untukmu yang ingin belajar tentang coding/pemrograman dan software engineering.
16+
{t("description")}
1417
</p>
1518
</div>
1619

src/features/home/components/ContactSection.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
import { Button } from "@/components/ui/button";
22
import { Send } from "lucide-react";
33
import { Link } from "@/lib/navigation";
4+
import { useTranslations } from "next-intl";
45

56
const ContactSection = () => {
7+
const t = useTranslations("HomePage.section-contact");
8+
69
return (
710
<div className="container py-10">
811
<div className="flex flex-col items-center md:gap-8 gap-6">
912
<div className="flex flex-col items-center gap-2">
10-
<h2 className="text-tertiary md:text-3xl text-2xl text-center font-bold">
11-
Punya pertanyaan atau ingin sekedar ngobrol? 😃
12-
</h2>
13+
<h2 className="text-tertiary md:text-3xl text-2xl text-center font-bold">{t("title")}</h2>
1314
<p className="max-w-3xl md:text-base text-center text-sm text-slate-500 dark:text-slate-400 md:leading-7">
14-
Kami dengan senang hati terhubung dengan kamu. Cukup klik tombol di bawah yaa!
15+
{t("description")}
1516
</p>
1617
</div>
1718

1819
<Button asChild variant="tertiary" className="flex items-center gap-2">
1920
<Link href="https://wa.me/6281355893352" target="_blank">
20-
Hubungi Kami <Send className="lg:w-6 w-5" />
21+
{t("contact-button")} <Send className="lg:w-6 w-5" />
2122
</Link>
2223
</Button>
2324
</div>

src/features/home/components/HeroSection.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,21 @@ import { Button } from "@/components/ui/button";
66
import { HandCoins } from "lucide-react";
77

88
const HeroSection = () => {
9-
const t = useTranslations("HomePage");
9+
const t = useTranslations("HomePage.section-hero");
1010
return (
1111
<div className="container py-32 flex lg:flex-row flex-col items-center gap-6 justify-between">
1212
<div className="basis-[50%]">
1313
<div className="space-y-4">
1414
<div className="space-y-1.5">
15-
<h1 className="text-hmc-primary md:text-[44px] text-3xl font-bold md:leading-[60px]">
16-
{t("section-hero.title")}
17-
</h1>
18-
<p className="text-slate-600 dark:text-slate-400">{t("section-hero.description")}</p>
15+
<h1 className="text-hmc-primary md:text-[44px] text-3xl font-bold md:leading-[60px]">{t("title")}</h1>
16+
<p className="text-slate-600 dark:text-slate-400">{t("description")}</p>
1917
</div>
2018

2119
{/* Social Media */}
2220
<div className="flex items-center gap-2">
2321
<Button asChild size="lg" className="flex items-center gap-2">
2422
<Link href="https://discord.com/invite/M9mNK6MBbu" target="_blank">
25-
{t("section-hero.join-button")} <HandCoins className="lg:w-6 w-5" />
23+
{t("join-button")} <HandCoins className="lg:w-6 w-5" />
2624
</Link>
2725
</Button>
2826
<div className="flex items-center gap-2">

src/features/home/components/PartnerSection.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ import { useTranslations } from "next-intl";
44
import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "@/components/ui/carousel";
55

66
const PartnerSection = () => {
7-
const t = useTranslations("HomePage");
7+
const t = useTranslations("HomePage.section-partner");
88
return (
99
<div className="bg-sky-50 dark:bg-slate-900">
1010
<div className="container md:py-14 py-10 my-10 space-y-8">
1111
<div className="flex flex-col items-center gap-2">
12-
<h2 className="text-tertiary md:text-3xl text-2xl font-bold">{t("section-partner.title")}</h2>
13-
<p className="md:text-base text-sm text-slate-500 dark:text-slate-400 md:text-center">
14-
{t("section-partner.description")}
15-
</p>
12+
<h2 className="text-tertiary md:text-3xl text-2xl font-bold">{t("title")}</h2>
13+
<p className="md:text-base text-sm text-slate-500 dark:text-slate-400 md:text-center">{t("description")}</p>
1614
</div>
1715

1816
<div className="px-12 md:px-12">

src/features/home/components/ProgramSection.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@ import { Card, CardContent, CardHeader } from "@/components/ui/card";
22

33
import Image from "next/image";
44
import { programData } from "../constants";
5+
import { useTranslations } from "next-intl";
56

67
const ProgramSection = () => {
8+
const t = useTranslations("HomePage.section-program");
9+
710
return (
811
<div className="container py-10 space-y-8">
912
<div className="flex flex-col gap-4">
10-
<h2 className="text-tertiary md:text-3xl text-2xl font-bold">Program Hammercode ✨</h2>
13+
<h2 className="text-tertiary md:text-3xl text-2xl font-bold">{t("title")}</h2>
1114
<p className="max-w-3xl md:text-base text-sm text-slate-500 dark:text-slate-400 md:leading-7">
12-
Kegiatan-kegiatan yang kami selenggarakan berorientasi pada knowledge-transfer yang diharapkan dapat
13-
mempercepat pemerataan keterampilan di bidang teknologi informasi serta mencetak talenta teknologi yang siap
14-
kerja.
15+
{t("description")}
1516
</p>
1617
</div>
1718

@@ -44,9 +45,9 @@ const ProgramSection = () => {
4445
<div className="bg-sky-100 dark:bg-sky-900 p-2 w-9 h-9 text-sm text-hmc-primary flex justify-center items-center rounded-lg">
4546
{data.id}
4647
</div>
47-
<h3 className="text-xl text-center font-semibold">{data.title}</h3>
48+
<h3 className="text-xl text-center font-semibold">{t(`programs.${data.id}.title`)}</h3>
4849
<p className="md:text-sm text-sm text-center text-slate-500 dark:text-slate-400 md:leading-6">
49-
{data.description}
50+
{t(`programs.${data.id}.description`)}
5051
</p>
5152
</div>
5253
</CardContent>

src/features/home/components/TestimonialSection.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import { testimonialData } from "../constants";
33
import { Card, CardFooter, CardHeader } from "@/components/ui/card";
44
import Image from "next/image";
55
import { Carousel, CarouselContent, CarouselItem } from "@/components/ui/carousel";
6+
import { useTranslations } from "next-intl";
67

78
const TestimonialSection = () => {
9+
const t = useTranslations("HomePage.section-testimonial");
810
return (
911
<div className="container py-10 space-y-8">
1012
<div className="flex flex-col space-y-2">
11-
<h2 className="text-tertiary md:text-3xl text-2xl font-bold">Manfaat 🌟</h2>
12-
<p className="md:text-base text-sm text-slate-500 dark:text-slate-400">
13-
Beberapa testimonial dari teman dan alumni yang merasakan manfaat dari Hammercode.
14-
</p>
13+
<h2 className="text-tertiary md:text-3xl text-2xl font-bold">{t("title")}</h2>
14+
<p className="md:text-base text-sm text-slate-500 dark:text-slate-400">{t("description")}</p>
1515
</div>
1616

1717
<Carousel className="w-full" isDots={true}>

src/features/home/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import HeroSection from "./components/HeroSection";
22
import PartnerSection from "./components/PartnerSection";
33
import AboutSection from "./components/AboutSection";
44
import ProgramSection from "./components/ProgramSection";
5-
import CourseSection from "./components/CourseSection";
5+
import ClassSection from "./components/ClassSection";
66
import TestimonialSection from "./components/TestimonialSection";
77
import ContactSection from "./components/ContactSection";
88

@@ -13,7 +13,7 @@ const Home = () => {
1313
<PartnerSection />
1414
<AboutSection />
1515
<ProgramSection />
16-
<CourseSection />
16+
<ClassSection />
1717
<TestimonialSection />
1818
<ContactSection />
1919
</div>

src/locales/en.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,25 @@
1010
"title": "Welcome to Hammercode 👋",
1111
"description": "Hammercode is a community based in Palu, Indonesia."
1212
},
13+
"Footer": {
14+
"resource": {
15+
"title": "Resources",
16+
"data": [
17+
{
18+
"name": "Home"
19+
},
20+
{
21+
"name": "About Us"
22+
}
23+
]
24+
},
25+
"social_media": {
26+
"title": "Let's Join with Us!"
27+
},
28+
"contact": {
29+
"title": "Contact"
30+
}
31+
},
1332
"HomePage": {
1433
"section-hero": {
1534
"title": "Boost Your Skills with High-Quality Classes!",
@@ -19,6 +38,43 @@
1938
"section-partner": {
2039
"title": "Learning From Our Expert Tech",
2140
"description": "Take the opportunity to learn from experts from tech companies"
41+
},
42+
"section-about": {
43+
"title": "Who We Are? 🤔",
44+
"sub-title": "Community to Advance our Hometown.",
45+
"description": "<b>Hammercode</b> is tech community initiated as a place for learner, programmer, developer, and the other tech industry players at Palu and surrounding areas.",
46+
"view-more-button": "View More"
47+
},
48+
"section-program": {
49+
"title": "Hammercode Programs ✨",
50+
"description": "Our activities orienting to knowledge-transfer which is expected to accelerate the distribution of skills in industry and to produce ready to work technology talents.",
51+
"programs": {
52+
"01": {
53+
"title": "Mentoring",
54+
"description": "Our community members from various tech company ready to help you with internship or full-time job application."
55+
},
56+
"02": {
57+
"title": "Workshops & Classes",
58+
"description": "Classes and workshops are available for various fields, such as the web, mobile apps to data. The level of presented material varies, from beginner to advanced."
59+
},
60+
"03": {
61+
"title": "Tech Talk",
62+
"description": "Monthly knowledge sharing activities brought by practitioner from industry and community members."
63+
}
64+
}
65+
},
66+
"section-class": {
67+
"title": "Hammercode Classes 🔥",
68+
"description": "Hammercode is a percect place for those to learn about coding/programming and software engineering."
69+
},
70+
"section-testimonial": {
71+
"title": "Impact Story 🌟",
72+
"description": "Some friends and alumni who feel the benefits from Hammercode."
73+
},
74+
"section-contact": {
75+
"title": "Got any question or just want casual chit-chat? 😃",
76+
"description": "We will love to be connected with you. Just hit the button below, yaa!",
77+
"contact-button": "Contact Us"
2278
}
2379
},
2480
"EventsPage": {

0 commit comments

Comments
 (0)