feat: implement proper i18n translations for Serbian and English

- Add comprehensive Serbian translation file (sr.json) with all UI strings
- Add comprehensive English translation file (en.json) with all UI strings
- Update Serbian root pages (/, /products, /products/[slug], /about, /contact) to use getTranslations()
- Update English pages (/en/*) to use getTranslations()
- Replace all hardcoded strings with translation keys
This commit is contained in:
Unchained
2026-03-23 18:28:00 +02:00
parent f72f32fe60
commit bcc51ce282
11 changed files with 700 additions and 577 deletions

View File

@@ -1,21 +1,25 @@
import { getProducts } from "@/lib/saleor";
import { getTranslations } from "next-intl/server";
import Header from "@/components/layout/Header";
import Footer from "@/components/layout/Footer";
import ProductCard from "@/components/product/ProductCard";
import { ChevronDown } from "lucide-react";
export const metadata = {
title: "Products - ManoonOils",
description: "Browse our collection of premium natural oils for hair and skin care.",
};
export async function generateMetadata() {
return {
title: "Products - ManoonOils",
description: "Browse our collection of premium natural oils for hair and skin care.",
};
}
export default async function EnglishProductsPage() {
const t = await getTranslations("Products");
const products = await getProducts("UK");
return (
<>
<Header />
<main className="min-h-screen bg-white">
<div className="pt-[72px] lg:pt-[72px]">
<div className="border-b border-[#e5e5e5]">
@@ -23,26 +27,26 @@ export default async function EnglishProductsPage() {
<div className="flex flex-col md:flex-row md:items-end md:justify-between gap-4">
<div>
<span className="text-xs uppercase tracking-[0.2em] text-[#666666] mb-2 block">
Our Collection
{t("collection")}
</span>
<h1 className="text-3xl md:text-4xl font-medium">
All Products
{t("allProducts")}
</h1>
</div>
<div className="flex items-center gap-3">
<span className="text-sm text-[#666666]">
{products.length} products
{t("productsCount", { count: products.length })}
</span>
<div className="relative">
<select
<select
className="appearance-none bg-transparent border border-[#e5e5e5] pl-4 pr-10 py-2 text-sm focus:outline-none focus:border-black cursor-pointer"
defaultValue="featured"
>
<option value="featured">Featured</option>
<option value="newest">Newest</option>
<option value="price-low">Price: Low to High</option>
<option value="price-high">Price: High to Low</option>
<option value="featured">{t("featured")}</option>
<option value="newest">{t("newest")}</option>
<option value="price-low">{t("priceLow")}</option>
<option value="price-high">{t("priceHigh")}</option>
</select>
<ChevronDown className="absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 pointer-events-none text-[#666666]" />
</div>
@@ -56,18 +60,18 @@ export default async function EnglishProductsPage() {
{products.length === 0 ? (
<div className="text-center py-20">
<p className="text-[#666666] mb-4">
No products available
{t("noProducts")}
</p>
<p className="text-sm text-[#999999]">
Please check back later for new arrivals.
{t("checkBack")}
</p>
</div>
) : (
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6 lg:gap-8">
{products.map((product, index) => (
<ProductCard
key={product.id}
product={product}
<ProductCard
key={product.id}
product={product}
index={index}
locale="EN"
/>
@@ -78,7 +82,7 @@ export default async function EnglishProductsPage() {
</section>
</div>
</main>
<div className="pt-16">
<Footer />
</div>