menu internationalization completed

This commit is contained in:
parsa aghaei 2024-10-20 12:32:00 +03:30
parent 05e942705d
commit e1f6eabcc9
6 changed files with 57 additions and 76 deletions

View File

@ -3,8 +3,11 @@ import BurgerButton from "../burger-button/burgerButton";
import Link from "next/link";
import SelectLanguage from "../selectLanguage/selectLanguage";
import { cookies } from "next/headers";
import { getDictionary } from "@/app/lib/functions/dictionaries";
import { getDefaultLocale } from "@/app/lib/functions/utils";
export default function Header() {
export default async function Header() {
const dict = await getDictionary(getDefaultLocale());
return (
<div
className="fixed z-40 flex h-[67px] w-full items-center justify-between bg-[#fff] px-2 py-[50px] xl:px-10"
@ -15,51 +18,51 @@ export default function Header() {
<img src={"/images/logo.svg"} className="w-full" alt="logo" />
</div>
<p className="ms-2 text-[20px] font-[900] capitalize text-[#FD6F00] sm:text-[23px] xl:ms-3 xl:text-[30px]">
parsa aghayi
{dict.header.Name}
</p>
</div>
<ul className="hidden items-center justify-center rounded p-2 lg:flex">
<a
href="/#home"
className="mx-2 whitespace-nowrap rounded-lg px-2 py-[10px] text-[18px] font-[600] hover:text-[#FD6F00]"
className="mx-2 whitespace-nowrap rounded-lg px-2 py-[10px] text-[18px] font-[600] hover:text-[#FD6F00] capitalize"
>
Home
{dict.header.Home}
</a>
<a
href="/#about-me"
className="mx-2 whitespace-nowrap rounded-lg px-2 py-[10px] text-[18px] font-[600] hover:text-[#FD6F00]"
className="mx-2 whitespace-nowrap rounded-lg px-2 py-[10px] text-[18px] font-[600] hover:text-[#FD6F00] capitalize"
>
About Me
{dict.header.AboutMe}
</a>
<a
href="/#services"
className="mx-2 whitespace-nowrap rounded-lg px-2 py-[10px] text-[18px] font-[600] hover:text-[#FD6F00]"
className="mx-2 whitespace-nowrap rounded-lg px-2 py-[10px] text-[18px] font-[600] hover:text-[#FD6F00] capitalize"
>
Services
{dict.header.Services}
</a>
<a
href="/#projects"
className="mx-2 whitespace-nowrap rounded-lg px-2 py-[10px] text-[18px] font-[600] hover:text-[#FD6F00]"
className="mx-2 whitespace-nowrap rounded-lg px-2 py-[10px] text-[18px] font-[600] hover:text-[#FD6F00] capitalize"
>
Projects
{dict.header.Projects}
</a>
<a
href="/#testimonials"
className="mx-2 whitespace-nowrap rounded-lg px-2 py-[10px] text-[18px] font-[600] hover:text-[#FD6F00]"
className="mx-2 whitespace-nowrap rounded-lg px-2 py-[10px] text-[18px] font-[600] hover:text-[#FD6F00] capitalize"
>
Testimonials
{dict.header.Testimonials}
</a>
<a
href="/#contact"
className="mx-2 whitespace-nowrap rounded-lg px-2 py-[10px] text-[18px] font-[600] hover:text-[#FD6F00]"
className="mx-2 whitespace-nowrap rounded-lg px-2 py-[10px] text-[18px] font-[600] hover:text-[#FD6F00] capitalize"
>
Contact
{dict.header.Contact}
</a>
<Link
className="mx-2 whitespace-nowrap rounded-lg px-2 py-[10px] text-[18px] font-[600] hover:text-[#FD6F00]"
className="mx-2 whitespace-nowrap rounded-lg px-2 py-[10px] text-[18px] font-[600] hover:text-[#FD6F00] capitalize"
href={"/blog"}
>
Blog
{dict.header.Blog}
</Link>
<SelectLanguage
selectedLocale={cookies().get("selectedLocale")}
@ -67,8 +70,8 @@ export default function Header() {
/>
</ul>
<div className="flex gap-1">
<button className="flex items-center justify-center whitespace-nowrap rounded-md bg-[#FD6F00] px-4 py-2 text-[16px] font-[600] text-[#fff] xl:text-[20px]">
Download CV
<button className="flex items-center justify-center whitespace-nowrap rounded-md bg-[#FD6F00] px-4 py-2 text-[16px] min-w-[100px] font-[600] text-[#fff] xl:text-[20px]">
{dict.header.Button}
</button>
<BurgerButton />
</div>

View File

@ -22,21 +22,21 @@ export default function SelectLanguage({
{selectedLocale ? (
<p
onClick={() => setisOpen(!isOpen)}
className="mx-2 cursor-pointer select-none whitespace-nowrap rounded-lg px-2 py-[10px] text-[18px] font-[600] hover:text-[#FD6F00]"
className="mx-2 mb-[5px] cursor-pointer select-none whitespace-nowrap border-b-2 border-[#FD6F00] px-2 py-[10px] pb-[5px] text-[18px] font-[600] text-[#FD6F00] hover:text-[#FD6F00]"
>
{selectedLocale?.value}
</p>
) : (
<p
onClick={() => setisOpen(!isOpen)}
className="mx-2 cursor-pointer select-none whitespace-nowrap rounded-lg px-2 py-[10px] text-[18px] font-[600] hover:text-[#FD6F00]"
className="mx-2 mb-[5px] cursor-pointer select-none whitespace-nowrap px-2 py-[10px] pb-[5px] text-[18px] font-[600] hover:text-[#FD6F00]"
>
{defaultLocale?.value}
</p>
)}
<ul
className={`absolute start-0 top-10 flex w-full flex-col items-center gap-2 rounded-lg border py-3 ${isOpen ? "scale-100" : "scale-0"}`}
className={`absolute start-0 z-20 flex w-full flex-col items-center gap-2 rounded-lg border bg-white py-3 transition-all ${isOpen ? "top-[50px] scale-100" : "top-0 scale-0"}`}
>
<li
className="w-[70%] border-b-2 border-[rgba(0,0,0,0)] pb-1 text-center hover:cursor-pointer hover:border-[#FD6F00]"

View File

@ -1,55 +0,0 @@
const siteTexts = {
en: {
homePage: {
top: {
greating: "Hi I am",
name: "parsa aghayi",
profession: "Frontend & Backend",
roll: "Developer",
descriptionAboutMe:
"My expertise lies in working with frameworks, focusing on optimizing performance and developing scalable web applications using modern technologies.",
},
services: {
title: "services",
description:
"In today's digital landscape, having a robust online presence is essential for businesses and individuals alike. Our services cater to a wide range of web development needs, ensuring that your project is functional, visually appealing, and user-friendly.",
},
projects: {
title: "my projects",
description:
"Explore a selection of my web development projects that showcase my ability to deliver high-quality solutions and create engaging digital experiences. See how I can help bring your vision to life!",
},
testimonials: {
title: "testimonials",
description:
"The Testimonials section features feedback from clients and collaborators, highlighting the quality of my services and commitment to client satisfaction. These authentic reviews reflect my professionalism and the positive impact of my work, giving potential clients confidence in choosing me for their web development needs.",
},
contact: {
slogan: "Lets Design Together",
description:
"The Contact Me section offers a simple way to reach out for inquiries, project proposals, or collaboration opportunities. Fill out the contact form or use the provided information, and I'll respond promptly to discuss your ideas and how I can help.",
button: "contact me",
placeholder: "Enter your Email address here...",
},
},
},
fa: {
homePage: {
top: {
greating: "اول از همه اسمم",
name: "پارسا آقایی",
profession: "Frontend & Backend",
roll: "Developer",
descriptionAboutMe:
"Lorem ipsum dolor sit amet consectetur. Tristique amet sed massanibh lectus netus in. Aliquet donec morbi convallis pretium. Turpis tempus pharetra",
},
services: {
title: "Services",
description:
"Lorem ipsum dolor sit amet consectetur. Tristique amet sed massa nibh lectus netus in. Aliquet donec morbi convallis pretium",
},
},
},
};
export default siteTexts;

View File

@ -25,5 +25,16 @@
"button": "contact me",
"placeholder": "Enter your Email address here..."
}
},
"header": {
"Name": "parsa aghayi",
"Home": "home",
"AboutMe": "about Me",
"Services": "services",
"Projects": "projects",
"Testimonials": "testimonials",
"Contact": "contact",
"Blog": "blog",
"Button": "Resume"
}
}

View File

@ -25,6 +25,17 @@
"button": "با من تماس بگیرید",
"placeholder": "ایمیل خود را اینجا وارد کنید..."
}
},
"header": {
"Name": "پارسا آقایی",
"Home": "خانه",
"AboutMe": "درباره‌من",
"Services": "خدمات",
"Projects": "پروژه‌ها",
"Testimonials": "دیدگاه‌ها",
"Contact": "تماس",
"Blog": "بلاگ",
"Button": "رزومه"
}
}

View File

@ -146,4 +146,15 @@ export type Dictionary = {
placeholder: string;
};
};
header: {
Name: string;
Home: string;
AboutMe: string;
Services: string;
Projects: string;
Testimonials: string;
Contact: string;
Blog: string;
Button: string;
};
};