Fix runtime default locale resolution
CI / quality (push) Waiting to run

This commit is contained in:
MOH
2026-03-15 06:02:27 +01:00
parent 9b8409a7d3
commit c18128c965
29 changed files with 330 additions and 108 deletions
+14 -5
View File
@@ -5,8 +5,9 @@ import { notFound } from "next/navigation";
import { Container } from "@/components/layout/container";
import { PageHero } from "@/components/layout/page-hero";
import { PortfolioProjectDetail } from "@/components/site/portfolio-project-detail";
import { getSiteSettings } from "@/lib/app-config";
import { buildLocalizedMetadata } from "@/lib/metadata";
import { resolveLocale } from "@/lib/locale";
import { FALLBACK_LOCALE, resolveLocale } from "@/lib/locale";
import {
getLocalizedValue,
getPublishedPortfolioProjectBySlug,
@@ -23,7 +24,7 @@ export const dynamic = "force-dynamic";
export async function generateMetadata({ params }: PortfolioItemPageProps): Promise<Metadata> {
const { locale, slug } = await params;
const localeKey = resolveLocale(locale);
const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
const item = await getPublishedPortfolioProjectBySlug(slug);
if (!item) {
@@ -47,14 +48,17 @@ export default async function PortfolioItemPage({
params,
}: PortfolioItemPageProps) {
const { locale, slug } = await params;
const localeKey = resolveLocale(locale);
const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
const item = await getPublishedPortfolioProjectBySlug(slug);
if (!item) {
notFound();
}
const t = await getTranslations({ locale: localeKey, namespace: "portfolioDetail" });
const [t, siteSettings] = await Promise.all([
getTranslations({ locale: localeKey, namespace: "portfolioDetail" }),
getSiteSettings(),
]);
return (
<>
@@ -64,7 +68,12 @@ export default async function PortfolioItemPage({
/>
<Container size="wide" className="pb-12 lg:pb-16">
<PortfolioProjectDetail item={item} locale={localeKey} t={t} />
<PortfolioProjectDetail
item={item}
locale={localeKey}
defaultLocale={siteSettings.defaultLocale}
t={t}
/>
</Container>
</>
);