From 3b20d4087c6524176e19c0c3fb9414e0706b5624 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Wed, 27 May 2026 13:13:55 +0200 Subject: [PATCH] fix(i18n): ensure 100% translation parity on all pages and components --- app/[locale]/[slug]/page.tsx | 2 +- app/[locale]/referenzen/page.tsx | 6 +++--- components/blocks/CallToAction.tsx | 16 +++++++++------- components/blocks/JobListingBlock.tsx | 22 +++++++++++++--------- messages/de.json | 19 ++++++++++++++++++- messages/en.json | 19 ++++++++++++++++++- 6 files changed, 62 insertions(+), 22 deletions(-) diff --git a/app/[locale]/[slug]/page.tsx b/app/[locale]/[slug]/page.tsx index 4294b97ae..fe931c83a 100644 --- a/app/[locale]/[slug]/page.tsx +++ b/app/[locale]/[slug]/page.tsx @@ -162,7 +162,7 @@ export default async function Page(props: { params: Promise<{ locale: string; sl ...loc, featuredImage: ref.frontmatter.featuredImage, details: [ - ref.frontmatter.client || 'Kunde', + ref.frontmatter.client || t('client'), ref.frontmatter.dateString || new Date(ref.frontmatter.date).getFullYear().toString(), ], }; diff --git a/app/[locale]/referenzen/page.tsx b/app/[locale]/referenzen/page.tsx index 8bcc0ee6f..2986a2d21 100644 --- a/app/[locale]/referenzen/page.tsx +++ b/app/[locale]/referenzen/page.tsx @@ -129,14 +129,14 @@ export default async function ReferenzenOverview(props: { params: Promise<{ loca {/* Technical Meta Data */}
- Kunde + {t('client')} - {ref.frontmatter.client} + {ref.frontmatter.client || t('client')}
- Zeitraum + {t('period')} {ref.frontmatter.dateString || new Date(ref.frontmatter.date).getFullYear()} diff --git a/components/blocks/CallToAction.tsx b/components/blocks/CallToAction.tsx index b65f9d70b..c50d9010a 100644 --- a/components/blocks/CallToAction.tsx +++ b/components/blocks/CallToAction.tsx @@ -3,6 +3,7 @@ import React from 'react'; import { Button } from '@/components/ui/Button'; import { motion } from 'framer-motion'; +import { useTranslations } from 'next-intl'; export interface CallToActionProps { title?: string; @@ -32,14 +33,15 @@ const itemVariants = { }, }; -export const CallToAction: React.FC = ({ - title = 'Bereit für Ihr Projekt?', - description = 'Wir suchen stets nach neuen Herausforderungen und starken Partnern. Kontaktieren Sie uns für eine unverbindliche Beratung zu Ihrem Vorhaben.', - ctaLabel = 'Jetzt Kontakt aufnehmen', - ctaHref = '/de/kontakt', - theme = 'light' -}) => { +export const CallToAction: React.FC = (props) => { + const { theme = 'light' } = props; const isDark = theme === 'dark'; + const t = useTranslations('CallToAction'); + + const title = props.title || t('title'); + const description = props.description || t('description'); + const ctaLabel = props.ctaLabel || t('ctaLabel'); + const ctaHref = props.ctaHref || t('ctaHref'); return (
diff --git a/components/blocks/JobListingBlock.tsx b/components/blocks/JobListingBlock.tsx index f80e931b3..95fd61157 100644 --- a/components/blocks/JobListingBlock.tsx +++ b/components/blocks/JobListingBlock.tsx @@ -5,6 +5,7 @@ import Link from 'next/link'; import { Button } from '@/components/ui/Button'; import { HoverShineOverlay } from '@/components/ui/HoverShineOverlay'; import { motion } from 'framer-motion'; +import { useTranslations } from 'next-intl'; export interface JobListingBlockProps { title?: string; @@ -45,20 +46,23 @@ const itemVariants = { }; export const JobListingBlock = (props: JobListingBlockProps) => { + const t = useTranslations('JobListingBlock'); + const { - title, showJobs = true, showFairs, - fairsTitle = 'Nächste Messetermine', + fairsTitle = t('fairsTitle'), fairs = [ { name: 'Intersolar München', date: 'Termin folgt', type: 'Energie-Messe', location: 'Messe München' }, { name: 'Windenergietage Linstow', date: 'Termin folgt', type: 'Fachkongress', location: 'Linstow' }, { name: 'Kabelwerkstatt Wiesbaden', date: 'Termin folgt', type: 'Fachmesse', location: 'Wiesbaden' } ], - emptyStateMessage = 'Aktuell sind alle Positionen besetzt. Senden Sie uns gerne eine Initiativbewerbung!', - emptyStateLinkText = 'Jetzt Kontakt aufnehmen', + emptyStateMessage = t('emptyStateMessage'), + emptyStateLinkText = t('emptyStateLinkText'), emptyStateLinkHref = '/kontakt' } = props; + + const title = props.title || t('title'); // Since Payload is removed, we use an empty array or static data const jobs: any[] = []; @@ -118,7 +122,7 @@ export const JobListingBlock = (props: JobListingBlockProps) => {
-

Datum

+

{t('date')}

{messe.date}

@@ -129,7 +133,7 @@ export const JobListingBlock = (props: JobListingBlockProps) => {
-

Location

+

{t('location')}

{messe.location}

@@ -141,7 +145,7 @@ export const JobListingBlock = (props: JobListingBlockProps) => {
-

Stand

+

{t('booth')}

{messe.booth}

@@ -180,7 +184,7 @@ export const JobListingBlock = (props: JobListingBlockProps) => { transition={{ duration: 0.8, ease: [0.16, 1, 0.3, 1] as const }} className="font-heading font-extrabold text-4xl text-neutral-dark mb-8" > - {title || 'Aktuelle Stellenangebote'} + {title} {jobs.length > 0 ? ( @@ -206,7 +210,7 @@ export const JobListingBlock = (props: JobListingBlockProps) => {

{job.location}

- Details ansehen + {t('viewDetails')}
diff --git a/messages/de.json b/messages/de.json index d30e47ec9..153718a42 100644 --- a/messages/de.json +++ b/messages/de.json @@ -159,7 +159,24 @@ "supportTeamAvailable": "Unser Expertenteam steht Ihnen für alle Fragen rund um Ihr Infrastrukturprojekt zur Verfügung.", "contactUs": "Kontaktieren Sie uns", "nextProjectTitle": "Ihr nächstes Projekt?", - "nextProjectDesc": "Lassen Sie uns gemeinsam herausragende Infrastruktur bauen." + "nextProjectDesc": "Lassen Sie uns gemeinsam herausragende Infrastruktur bauen.", + "client": "Kunde", + "period": "Zeitraum" + }, + "CallToAction": { + "title": "Bereit für Ihr Projekt?", + "description": "Wir suchen stets nach neuen Herausforderungen und starken Partnern. Kontaktieren Sie uns für eine unverbindliche Beratung zu Ihrem Vorhaben.", + "ctaLabel": "Jetzt Kontakt aufnehmen" + }, + "JobListingBlock": { + "fairsTitle": "Nächste Messetermine", + "emptyStateMessage": "Aktuell sind alle Positionen besetzt. Senden Sie uns gerne eine Initiativbewerbung!", + "emptyStateLinkText": "Jetzt Kontakt aufnehmen", + "date": "Datum", + "location": "Location", + "booth": "Stand", + "viewDetails": "Details ansehen", + "title": "Aktuelle Stellenangebote" }, "Error": { "title": "Hoppla!", diff --git a/messages/en.json b/messages/en.json index 55d746d43..91ece7ddf 100644 --- a/messages/en.json +++ b/messages/en.json @@ -159,7 +159,24 @@ "supportTeamAvailable": "Our team of experts is available to answer all your questions regarding your infrastructure project.", "contactUs": "Contact Us", "nextProjectTitle": "Your next project?", - "nextProjectDesc": "Let's build outstanding infrastructure together." + "nextProjectDesc": "Let's build outstanding infrastructure together.", + "client": "Client", + "period": "Period" + }, + "CallToAction": { + "title": "Ready for your project?", + "description": "We are always looking for new challenges and strong partners. Contact us for a non-binding consultation about your project.", + "ctaLabel": "Contact us now" + }, + "JobListingBlock": { + "fairsTitle": "Upcoming Trade Fairs", + "emptyStateMessage": "All positions are currently filled. Feel free to send us an unsolicited application!", + "emptyStateLinkText": "Contact us now", + "date": "Date", + "location": "Location", + "booth": "Booth", + "viewDetails": "View details", + "title": "Current Job Openings" }, "Error": { "title": "Oops!",