Compare commits

...

2 Commits

Author SHA1 Message Date
fe829b0c4c chore: ignore next-env.d.ts in prettier to prevent flapping
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 11s
Build & Deploy / 🧪 QA (push) Failing after 30s
Build & Deploy / 🏗️ Build (push) Has been skipped
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 2s
2026-02-11 12:09:00 +01:00
9ed08004af fix(i18n): harden locale validation and fix missing translation tags 2026-02-11 12:07:08 +01:00
7 changed files with 40 additions and 14 deletions

11
.prettierignore Normal file
View File

@@ -0,0 +1,11 @@
# Ignore Next.js auto-generated environment file
# It often uses different quote styles than our project config
next-env.d.ts
# Ignore build output
.next
dist
out
# Ignore other potentially generated files
pnpm-lock.yaml

View File

@@ -2,11 +2,18 @@ import { getRequestConfig } from 'next-intl/server';
import * as Sentry from '@sentry/nextjs';
export default getRequestConfig(async ({ requestLocale }) => {
let locale = await requestLocale;
// Hardened locale validation: only allow 'en' or 'de'
// Use a temporary variable to validate before assigning to locale
const rawLocale = await requestLocale;
const supportedLocales = ['en', 'de'];
const locale =
typeof rawLocale === 'string' && supportedLocales.includes(rawLocale) ? rawLocale : 'en';
// Ensure that a valid locale is used
if (!locale || !['en', 'de'].includes(locale)) {
locale = 'en';
// Log to Sentry if we had to fallback, as it might indicate a routing issue
if (!rawLocale || !supportedLocales.includes(rawLocale as string)) {
console.warn(
`[i18n] Invalid or missing requestLocale received: "${rawLocale}". Falling back to "en".`,
);
}
return {
@@ -26,6 +33,6 @@ export default getRequestConfig(async ({ requestLocale }) => {
return path;
}
return 'fallback';
}
},
} as any;
});

View File

@@ -206,7 +206,7 @@
"title": "Produktportfolio | Hochwertige Kabel für jede Anwendung",
"description": "Entdecken Sie unser umfassendes Sortiment an zertifizierten Kabeln: von Niederspannung über Mittel- und Hochspannung bis hin zu spezialisierten Solarkabeln."
},
"title": "Unsere Produkte",
"title": "Unsere <green>Produkte</green>",
"subtitle": "Entdecken Sie unser umfassendes Sortiment an hochwertigen Kabeln für jede Anwendung.",
"heroSubtitle": "Produktportfolio",
"categoryLabel": "Kategorie",
@@ -393,4 +393,4 @@
"cta": "Zurück zur Sicherheit"
}
}
}
}

View File

@@ -206,7 +206,7 @@
"title": "Product Portfolio | High-Quality Cables for Every Application",
"description": "Explore our comprehensive range of certified cables: from low voltage to medium and high voltage, as well as specialized solar cables."
},
"title": "Our Products",
"title": "Our <green>Products</green>",
"subtitle": "Explore our comprehensive range of high-quality cables designed for every application.",
"heroSubtitle": "Product Portfolio",
"categoryLabel": "Category",
@@ -393,4 +393,4 @@
"cta": "Back to Safety"
}
}
}
}

2
next-env.d.ts vendored
View File

@@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import './.next/types/routes.d.ts';
import "./.next/types/routes.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

View File

@@ -5,6 +5,10 @@ const dsn = process.env.SENTRY_DSN;
Sentry.init({
dsn,
enabled: Boolean(dsn),
tracesSampleRate: 0,
});
// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,
// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
});

View File

@@ -5,6 +5,10 @@ const dsn = process.env.SENTRY_DSN;
Sentry.init({
dsn,
enabled: Boolean(dsn),
tracesSampleRate: 0,
});
// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,
// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
});