From aa2260f212c012b311b371dbcab7a48f9457117e Mon Sep 17 00:00:00 2001 From: "nabijonovdavronbek619@gmail.com" Date: Sat, 29 Nov 2025 13:48:55 +0500 Subject: [PATCH] translation bug fixed --- app/[locale]/layout.tsx | 26 - app/[locale]/page.tsx | 36 -- app/layout.tsx | 50 +- app/page.tsx | 31 +- components/About.tsx | 8 +- components/ContactForm.tsx | 28 +- components/FAQ.tsx | 10 +- components/Footer.tsx | 9 +- components/Navbar.tsx | 34 +- components/ProductCard.tsx | 13 +- components/ProductsGrid.tsx | 6 +- components/ShowCase.tsx | 30 +- components/languageSwitcher.tsx | 45 ++ components/ui/dropdown-menu.tsx | 257 +++++++++ context/language-context.tsx | 32 ++ i18n.config.ts | 4 - i18n/request.ts | 18 +- lib/products.ts | 21 +- lib/translations.ts | 159 ++++++ middlewere.ts | 10 + next-intl.config.ts | 8 + next.config.ts | 19 +- package-lock.json | 899 +++++++++++++++++++++++++++++++- package.json | 6 +- public/product/product1.jpg | Bin 0 -> 32780 bytes public/product/product2.jpg | Bin 0 -> 117891 bytes public/product/product3.jpg | Bin 0 -> 314711 bytes tsconfig.json | 4 +- 28 files changed, 1521 insertions(+), 242 deletions(-) delete mode 100644 app/[locale]/layout.tsx delete mode 100644 app/[locale]/page.tsx create mode 100644 components/languageSwitcher.tsx create mode 100644 components/ui/dropdown-menu.tsx create mode 100644 context/language-context.tsx delete mode 100644 i18n.config.ts create mode 100644 lib/translations.ts create mode 100644 middlewere.ts create mode 100644 next-intl.config.ts create mode 100644 public/product/product1.jpg create mode 100644 public/product/product2.jpg create mode 100644 public/product/product3.jpg diff --git a/app/[locale]/layout.tsx b/app/[locale]/layout.tsx deleted file mode 100644 index 5e1ac23..0000000 --- a/app/[locale]/layout.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { ReactNode } from "react"; -import { notFound } from "next/navigation"; -import { locales } from "@/i18n.config"; - -export function generateStaticParams() { - return locales.map((locale) => ({ locale })); -} - -interface LocaleLayoutProps { - children: ReactNode; - params: Promise<{ - locale: string; - }>; -} - -async function LocaleLayout({ children, params }: LocaleLayoutProps) { - const { locale } = await params; - - if (!locales.includes(locale as any)) { - notFound(); - } - - return <>{children}; -} - -export default LocaleLayout; diff --git a/app/[locale]/page.tsx b/app/[locale]/page.tsx deleted file mode 100644 index 387ba27..0000000 --- a/app/[locale]/page.tsx +++ /dev/null @@ -1,36 +0,0 @@ -"use client"; - -import { Navbar } from "@/components/Navbar"; -import { ShowCase } from "@/components/ShowCase"; -import { About } from "@/components/About"; -import { ProductsGrid } from "@/components/ProductsGrid"; -import { FAQ } from "@/components/FAQ"; -import { ContactForm } from "@/components/ContactForm"; -import { Footer } from "@/components/Footer"; - -const HERO_IMAGES = [ - "/product/product.jpg", - "/product/product.jpg", - "/product/product.jpg", - "/product/product.jpg", - "/product/product.jpg", -]; - -export default function Home() { - return ( -
- - - - - - -
-
- ); -} diff --git a/app/layout.tsx b/app/layout.tsx index 5cea82a..e33fd6c 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,48 +1,18 @@ -import type { Metadata } from "next"; -import { Geist, Geist_Mono } from "next/font/google"; + + import { ReactNode } from "react"; -import { NextIntlClientProvider } from "next-intl"; -import { getMessages } from "next-intl/server"; -import "./globals.css"; - -const geistSans = Geist({ - variable: "--font-geist-sans", - subsets: ["latin"], -}); - -const geistMono = Geist_Mono({ - variable: "--font-geist-mono", - subsets: ["latin"], -}); - -export const metadata: Metadata = { - title: "Firma - Industrial Equipment & Pumps", - description: - "Premium industrial pumps and equipment supplier with 10+ years of experience", -}; - -async function RootLayout({ - children, - params, -}: Readonly<{ - children: ReactNode; - params: Promise>; -}>) { - const resolvedParams = await params; - const locale = resolvedParams.locale || "uz"; - const messages = await getMessages(); +import "../i18n/request"; // i18n config faylini import qilamiz +import { LanguageProvider } from "@/context/language-context"; +import './globals.css' +export default function RootLayout({ children }: { children: ReactNode }) { return ( - - - + + + {children} - + ); } - -export default RootLayout; diff --git a/app/page.tsx b/app/page.tsx index 5813ded..d1513c7 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,5 +1,32 @@ -import { redirect } from "next/navigation"; +"use client"; + +import { Navbar } from "@/components/Navbar"; +import { ShowCase } from "@/components/ShowCase"; +import { About } from "@/components/About"; +import { ProductsGrid } from "@/components/ProductsGrid"; +import { FAQ } from "@/components/FAQ"; +import { ContactForm } from "@/components/ContactForm"; +import { Footer } from "@/components/Footer"; + +const HERO_IMAGES = [ + "/product/product.jpg", + "/product/product1.jpg", + "/product/product2.jpg", + "/product/product3.jpg", +]; export default function Home() { - redirect('/uz') + return ( +
+ + + + + + +
+
+ ); } diff --git a/components/About.tsx b/components/About.tsx index 79cdd37..dfa7eaf 100644 --- a/components/About.tsx +++ b/components/About.tsx @@ -1,11 +1,11 @@ "use client"; +import { useLanguage } from "@/context/language-context"; import { motion } from "framer-motion"; import { CheckCircle, Award, Users, Zap } from "lucide-react"; -import { useTranslations } from "next-intl"; export function About() { - const t = useTranslations(); + const {t} = useLanguage(); const features = [ { icon: Award, labelKey: "Experience", value: "10+ лет" }, @@ -37,7 +37,7 @@ export function About() { className="text-center mb-16" >

- {t("about.title")} + {t.about.title}

@@ -51,7 +51,7 @@ export function About() { viewport={{ once: true }} >

- {t("about.content")} + {t.about.content}

- {t("contact.title")} + {t.contact.title}

@@ -155,14 +155,14 @@ export function ContactForm() { {/* Name */}
@@ -170,14 +170,14 @@ export function ContactForm() { {/* Phone */}
@@ -186,13 +186,13 @@ export function ContactForm() { {/* Message */}