From 2ae57940f040e536b354c3d0ba575eef04b697e8 Mon Sep 17 00:00:00 2001 From: ahasani194 Date: Sat, 7 Jun 2025 16:36:59 +0330 Subject: [PATCH] feat: update NotFound and contact components for improved internationalization support --- src/app/[...not_found]/page.tsx | 24 +++++++------ src/assets/constants/routeFactory/index.ts | 2 +- .../pages/contact/ContactMeForm.tsx | 36 +++++++------------ src/components/pages/contact/TouchUs.tsx | 23 ++++++------ 4 files changed, 41 insertions(+), 44 deletions(-) diff --git a/src/app/[...not_found]/page.tsx b/src/app/[...not_found]/page.tsx index cfc1256..7802305 100644 --- a/src/app/[...not_found]/page.tsx +++ b/src/app/[...not_found]/page.tsx @@ -1,16 +1,24 @@ import routeFactory from '@/assets/constants/routeFactory'; import images from '@/assets/images/images'; import Button from '@/components/uikit/button'; -import { t } from '@/locales/translates'; +import { ILayoutLocaleParams } from '@/models/layout'; +import { getTranslations } from 'next-intl/server'; + +export default async function NotFound({ + params, +}: { + params: ILayoutLocaleParams; +}) { + const t = await getTranslations({ locale: params.locale }); + const routes = routeFactory(t, params.locale); -export default function NotFound() { return (

- {t('pages_notFound_title') as string} + {t('pages_notFound_title')}

- {t('pages_notFound_description') as string} + {t('pages_notFound_description')}

-
); diff --git a/src/assets/constants/routeFactory/index.ts b/src/assets/constants/routeFactory/index.ts index ef713f6..fef0986 100644 --- a/src/assets/constants/routeFactory/index.ts +++ b/src/assets/constants/routeFactory/index.ts @@ -38,7 +38,7 @@ const routeFactory: RouteFactory = (t, locale) => ({ }, contact: { title: t('pages_contact_title'), - route: () => `/${locale}/contact`, + route: () => `/${locale}/contact-us`, }, }); diff --git a/src/components/pages/contact/ContactMeForm.tsx b/src/components/pages/contact/ContactMeForm.tsx index 4a39038..28232de 100644 --- a/src/components/pages/contact/ContactMeForm.tsx +++ b/src/components/pages/contact/ContactMeForm.tsx @@ -1,40 +1,30 @@ +'use client'; + import Button from '@/components/uikit/button'; import FormField from '@/components/uikit/inputs'; -import { t } from '@/locales/translates'; +import { useTranslations } from 'next-intl'; const ContactForm = () => { + const t = useTranslations(); + return (

- {t('com_contact_title') as string}{' '} + {t('com_contact_title')}{' '} - {' '} - {t('com_contact_title_bold') as string} + {t('com_contact_title_bold')}

- - - + +
- - - + + + - +
); diff --git a/src/components/pages/contact/TouchUs.tsx b/src/components/pages/contact/TouchUs.tsx index 6efbd1f..2a4cdc7 100644 --- a/src/components/pages/contact/TouchUs.tsx +++ b/src/components/pages/contact/TouchUs.tsx @@ -1,22 +1,25 @@ +'use client'; + import { Icon } from '@/components/uikit/icons'; -import { t } from '@/locales/translates'; +import { useTranslations } from 'next-intl'; const TouchUs = () => { + const t = useTranslations(); + return (
- {' '} -

{t('pages_contact_title') as string}

+

{t('pages_contact_title')}

- {t('com_contact_touch_title') as string}{' '} + {t('com_contact_touch_title')}{' '} - {t('com_contact_touch_title_bold') as string} + {t('com_contact_touch_title_bold')}

- {t('com_contact_touch_description') as string} + {t('com_contact_touch_description')}

@@ -26,7 +29,7 @@ const TouchUs = () => {

- {t('com_contact_touch_option_1') as string} + {t('com_contact_touch_option_1')}

+44 (0) 20 1234 5678

@@ -38,7 +41,7 @@ const TouchUs = () => {

- {t('com_contact_touch_option_2') as string} + {t('com_contact_touch_option_2')}

support@mybusiness.com

@@ -50,10 +53,10 @@ const TouchUs = () => {

- {t('com_contact_touch_option_3') as string} + {t('com_contact_touch_option_3')}

- {t('com_contact_touch_option_3_description') as string} + {t('com_contact_touch_option_3_description')}