Working state: Serbian at root (/), English at /en, proper i18n structure

This commit is contained in:
Neo
2026-03-04 08:48:13 +00:00
commit cbb49ba64f
51 changed files with 10050 additions and 0 deletions

15
src/i18n/index.ts Normal file
View File

@@ -0,0 +1,15 @@
import { getRequestConfig } from "next-intl/server";
import { notFound } from "next/navigation";
export const locales = ["en", "sr"] as const;
export type Locale = (typeof locales)[number];
export default getRequestConfig(async ({ locale }) => {
const currentLocale = locale || "sr";
if (!locales.includes(currentLocale as Locale)) notFound();
return {
locale: currentLocale,
messages: (await import(`./messages/${currentLocale}.json`)).default,
};
});

53
src/i18n/messages/en.json Normal file
View File

@@ -0,0 +1,53 @@
{
"Navigation": {
"home": "Home",
"products": "Products",
"about": "About",
"contact": "Contact"
},
"Home": {
"hero": {
"title": "Premium Natural Oils",
"subtitle": "For hair and skin care"
},
"ticker": {
"text": "Free shipping on orders over 3000 RSD • Natural ingredients • Cruelty-free • Handmade with love"
},
"products": {
"title": "Our Products"
},
"bestsellers": {
"title": "Best Sellers"
},
"story": {
"title": "Our Story",
"description": "ManoonOils was born from a passion for natural beauty..."
},
"newsletter": {
"title": "Stay Updated",
"placeholder": "Enter your email",
"button": "Subscribe"
}
},
"Product": {
"addToCart": "Add to Cart",
"outOfStock": "Out of Stock",
"details": "Details",
"ingredients": "Ingredients",
"usage": "How to Use",
"related": "You May Also Like"
},
"Cart": {
"title": "Your Cart",
"empty": "Your cart is empty",
"continueShopping": "Continue Shopping",
"checkout": "Checkout",
"subtotal": "Subtotal",
"remove": "Remove"
},
"Footer": {
"quickLinks": "Quick Links",
"customerService": "Customer Service",
"copyright": "All rights reserved."
}
}

53
src/i18n/messages/sr.json Normal file
View File

@@ -0,0 +1,53 @@
{
"Navigation": {
"home": "Početna",
"products": "Proizvodi",
"about": "O nama",
"contact": "Kontakt"
},
"Home": {
"hero": {
"title": "Premium prirodna ulja",
"subtitle": "Za negu kose i kože"
},
"ticker": {
"text": "Besplatna dostava za porudžbine preko 3000 RSD • Prirodni sastojci • Bez okrutnosti • Ručno sa ljubavlju"
},
"products": {
"title": "Naši proizvodi"
},
"bestsellers": {
"title": "Najprodavaniji"
},
"story": {
"title": "Naša priča",
"description": "ManoonOils je rođen iz strasti za prirodnu lepotu..."
},
"newsletter": {
"title": "Ostanite u toku",
"placeholder": "Unesite vaš email",
"button": "Pretplati se"
}
},
"Product": {
"addToCart": "Dodaj u korpu",
"outOfStock": "Nema na stanju",
"details": "Detalji",
"ingredients": "Sastojci",
"usage": "Način upotrebe",
"related": "Takođe će vam se svideti"
},
"Cart": {
"title": "Vaša korpa",
"empty": "Vaša korpa je prazna",
"continueShopping": "Nastavite kupovinu",
"checkout": "Kupovina",
"subtotal": "Ukupno",
"remove": "Ukloni"
},
"Footer": {
"quickLinks": "Brze veze",
"customerService": "Korisnička podrška",
"copyright": "Sva prava zadržana."
}
}

15
src/i18n/request.tsx Normal file
View File

@@ -0,0 +1,15 @@
import { getRequestConfig } from 'next-intl/server';
import { routing } from './routing';
export default getRequestConfig(async ({ requestLocale }) => {
let locale = await requestLocale;
if (!locale || !routing.locales.includes(locale as any)) {
locale = routing.defaultLocale;
}
return {
locale,
messages: (await import(`./messages/${locale}.json`)).default
};
});

6
src/i18n/routing.ts Normal file
View File

@@ -0,0 +1,6 @@
import { defineRouting } from 'next-intl/routing';
export const routing = defineRouting({
locales: ['en', 'sr'],
defaultLocale: 'sr'
});