categoriySingle page internationalization added

This commit is contained in:
parsa aghaei 2024-10-21 12:29:58 +03:30
parent 693664017c
commit 12df663ef2
4 changed files with 19 additions and 4 deletions

View File

@ -5,6 +5,8 @@ import Link from "next/link";
import { redirect } from "next/navigation";
import NoDataFounded from "../../components/no-data-founded/noDataFounded";
import Pagination from "../../components/pagination/pagination";
import { getDictionary } from "@/app/lib/functions/dictionaries";
import { getDefaultLocale } from "@/app/lib/functions/utils";
async function fetchCategoryData(
categorySlug: string,
@ -44,6 +46,8 @@ export default async function SingleCategory({
params,
searchParams,
}: categorySlugPropsType) {
const dict = await getDictionary(getDefaultLocale());
const categoryData: CategoryDataType = await fetchCategoryData(
params.categorySlug,
new URLSearchParams(searchParams as Record<string, string>),
@ -61,7 +65,8 @@ export default async function SingleCategory({
<div className="flex w-full flex-wrap gap-2">
<div className="flex gap-2">
<p className="text-[14px] font-[600] text-blog-text-passive md:text-[16px]">
Total Posts:
{dict.blog.categoriySinglePage.total}
{params.categorySlug.replaceAll(/%20|-|_/g, " ")}
</p>
<span className="text-[14px] font-[400] text-blog-text-default md:text-[16px]">
{categoryData.meta.total}
@ -76,7 +81,7 @@ export default async function SingleCategory({
href={"/blog"}
className="text-[12px] font-[400] capitalize text-blog-text-passive hover:underline"
>
Home
{dict.blog.header.Home}
</Link>
<span className="mt-[-2px] -rotate-45 scale-[3] select-none text-[12px] font-[400] text-blog-text-passive">
-
@ -87,7 +92,7 @@ export default async function SingleCategory({
href={"/blog/categories"}
className="text-[12px] font-[400] capitalize text-blog-text-passive hover:underline"
>
Categories
{dict.blog.header.Categories}
</Link>
<span className="mt-[-2px] -rotate-45 scale-[3] select-none text-[12px] font-[400] text-blog-text-passive">
-
@ -118,7 +123,7 @@ export default async function SingleCategory({
<div className="mb-2 flex w-full flex-wrap gap-2">
<div className="flex gap-2">
<p className="text-[14px] font-[600] text-blog-text-passive md:text-[16px]">
BY
{dict.blog.homePage.by}
</p>
<Link
href={"/"}
@ -147,6 +152,7 @@ export default async function SingleCategory({
<Pagination
meta={categoryData.meta}
baseUrl={`/blog/categories/${categoryData.category.slug}`}
dict={dict}
/>
)}
</div>

View File

@ -72,6 +72,9 @@
"pageTitle": "all categories list",
"description": "Browse through our collection of categories to find posts on your favorite topics. Whether you`re looking for insightful articles, how-tos, or the latest trends, our categories make it easy to discover content tailored to your interests."
},
"categoriySinglePage": {
"total": "total posts of "
},
"header": {
"Home": "Home",
"New": "New",

View File

@ -72,6 +72,9 @@
"title": "دسته‌بندی‌ها",
"description": "برای یافتن پست هایی در مورد موضوعات مورد علاقه خود، در مجموعه دسته بندی های ما مرور کنید. فرقی نمی‌کند به دنبال مقالات روشن‌فکر، روش‌ها یا آخرین روندها باشید، دسته‌های ما کشف محتوای متناسب با علایق شما را آسان می‌کنند."
},
"categoriySinglePage": {
"total": "تعداد کل پست‌های "
},
"header": {
"Home": "خانه",
"New": "جدیدترین‌ها",

View File

@ -192,6 +192,9 @@ export type Dictionary = {
pageTitle: string;
description: string;
};
categoriySinglePage: {
total: string;
};
header: {
Home: string;
New: string;