From de2554a2e7f2cf6e90a6f501a29ddf6e67ebead5 Mon Sep 17 00:00:00 2001 From: "nabijonovdavronbek619@gmail.com" Date: Tue, 27 Jan 2026 17:36:09 +0500 Subject: [PATCH] language Switcher added --- app/{ => [locale]}/about/page.tsx | 0 app/{ => [locale]}/contact/page.tsx | 0 app/{ => [locale]}/faq/page.tsx | 0 app/[locale]/home/page.tsx | 25 ++ app/{ => [locale]}/products/[slug]/page.tsx | 0 app/{ => [locale]}/products/page.tsx | 0 app/{ => [locale]}/services/page.tsx | 0 app/layout.tsx | 23 +- app/page.tsx | 24 +- components/languageSwitcher.tsx | 120 ++++++ components/layout/navbar.tsx | 4 + i18n/config.ts | 16 + i18n/request.ts | 25 ++ lib/i18n-utils.ts | 23 + {locales => messages}/en.json | 0 {locales => messages}/ru.json | 0 {locales => messages}/uz.json | 0 middleware.ts | 136 ++++++ next.config.mjs | 14 +- package.json | 4 + pnpm-lock.yaml | 448 ++++++++++++++++++++ 21 files changed, 830 insertions(+), 32 deletions(-) rename app/{ => [locale]}/about/page.tsx (100%) rename app/{ => [locale]}/contact/page.tsx (100%) rename app/{ => [locale]}/faq/page.tsx (100%) create mode 100644 app/[locale]/home/page.tsx rename app/{ => [locale]}/products/[slug]/page.tsx (100%) rename app/{ => [locale]}/products/page.tsx (100%) rename app/{ => [locale]}/services/page.tsx (100%) create mode 100644 components/languageSwitcher.tsx create mode 100644 i18n/config.ts create mode 100644 i18n/request.ts create mode 100644 lib/i18n-utils.ts rename {locales => messages}/en.json (100%) rename {locales => messages}/ru.json (100%) rename {locales => messages}/uz.json (100%) create mode 100644 middleware.ts diff --git a/app/about/page.tsx b/app/[locale]/about/page.tsx similarity index 100% rename from app/about/page.tsx rename to app/[locale]/about/page.tsx diff --git a/app/contact/page.tsx b/app/[locale]/contact/page.tsx similarity index 100% rename from app/contact/page.tsx rename to app/[locale]/contact/page.tsx diff --git a/app/faq/page.tsx b/app/[locale]/faq/page.tsx similarity index 100% rename from app/faq/page.tsx rename to app/[locale]/faq/page.tsx diff --git a/app/[locale]/home/page.tsx b/app/[locale]/home/page.tsx new file mode 100644 index 0000000..71136c5 --- /dev/null +++ b/app/[locale]/home/page.tsx @@ -0,0 +1,25 @@ +import { + AboutUs, + Banner, + Blog, + Line, + OurService, + Statistics, + Testimonial, + Video, +} from "@/components/pages/home"; + +export default function Home() { + return ( +
+ + + +
+ ); +} diff --git a/app/products/[slug]/page.tsx b/app/[locale]/products/[slug]/page.tsx similarity index 100% rename from app/products/[slug]/page.tsx rename to app/[locale]/products/[slug]/page.tsx diff --git a/app/products/page.tsx b/app/[locale]/products/page.tsx similarity index 100% rename from app/products/page.tsx rename to app/[locale]/products/page.tsx diff --git a/app/services/page.tsx b/app/[locale]/services/page.tsx similarity index 100% rename from app/services/page.tsx rename to app/[locale]/services/page.tsx diff --git a/app/layout.tsx b/app/layout.tsx index 5fc847d..8703c8c 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -4,9 +4,8 @@ import { Geist, Geist_Mono } from "next/font/google"; import { Analytics } from "@vercel/analytics/next"; import "./globals.css"; import { Footer, Navbar } from "@/components/layout"; - -const _geist = Geist({ subsets: ["latin"] }); -const _geistMono = Geist_Mono({ subsets: ["latin"] }); +import { NextIntlClientProvider } from "next-intl"; +import { getMessages } from "next-intl/server"; export const metadata: Metadata = { title: "FireForce - Emergency Services", @@ -32,18 +31,24 @@ export const metadata: Metadata = { }, }; -export default function RootLayout({ +export default async function RootLayout({ children, + params, }: Readonly<{ children: React.ReactNode; + params: any; }>) { + const { locale } = await params; + const messages: any = await getMessages(); return ( - + - - {children} -