Fix request locale resolution in site pages
CI / quality (push) Waiting to run

This commit is contained in:
MOH
2026-03-15 08:20:39 +01:00
parent c18128c965
commit 288e4b37d7
10 changed files with 80 additions and 81 deletions
+9 -11
View File
@@ -1,14 +1,14 @@
import type { Metadata } from "next";
import { unstable_noStore as noStore } from "next/cache";
import { Sparkles } from "lucide-react";
import { getTranslations } from "next-intl/server";
import { getLocale, getTranslations } from "next-intl/server";
import { FloatingPreferences } from "@/components/layout/floating-preferences";
import { MotionFade } from "@/components/motion-fade";
import { HeroShell, HeroTitle } from "@/components/layout/site-hero";
import { getSiteSettings } from "@/lib/app-config";
import { buildLocalizedMetadata } from "@/lib/metadata";
import { FALLBACK_LOCALE, resolveLocale } from "@/lib/locale";
import { resolveLocale } from "@/lib/locale";
type ComingSoonPageProps = {
params: Promise<{
@@ -21,10 +21,10 @@ export const revalidate = 0;
export async function generateMetadata({ params }: ComingSoonPageProps): Promise<Metadata> {
noStore();
const { locale } = await params;
const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
const t = await getTranslations({ locale: localeKey, namespace: "comingSoon" });
await params;
const siteSettings = await getSiteSettings();
const localeKey = resolveLocale(await getLocale().catch(() => siteSettings.defaultLocale), siteSettings.defaultLocale);
const t = await getTranslations({ locale: localeKey, namespace: "comingSoon" });
return await buildLocalizedMetadata({
locale: localeKey,
@@ -39,12 +39,10 @@ export default async function ComingSoonPage({
params,
}: ComingSoonPageProps) {
noStore();
const { locale } = await params;
const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
const [t, siteSettings] = await Promise.all([
getTranslations({ locale: localeKey, namespace: "comingSoon" }),
getSiteSettings(),
]);
await params;
const siteSettings = await getSiteSettings();
const localeKey = resolveLocale(await getLocale().catch(() => siteSettings.defaultLocale), siteSettings.defaultLocale);
const t = await getTranslations({ locale: localeKey, namespace: "comingSoon" });
const isArabic = localeKey === "ar";
const lines = [
{