feat(i18n): add localized navigation and news translations

This commit is contained in:
2026-02-12 21:29:15 +01:00
parent 618319dbc2
commit a7895e4dd9
12 changed files with 687 additions and 164 deletions

View File

@@ -1,15 +1,15 @@
import { getPostBySlug } from "@cms/db"
import { getPostBySlugForLocale } from "@cms/db"
import { notFound } from "next/navigation"
export const dynamic = "force-dynamic"
type PageProps = {
params: Promise<{ slug: string }>
params: Promise<{ locale: string; slug: string }>
}
export default async function PublicNewsDetailPage({ params }: PageProps) {
const { slug } = await params
const post = await getPostBySlug(slug)
const { locale, slug } = await params
const post = await getPostBySlugForLocale(slug, locale)
if (!post || post.status !== "published") {
notFound()

View File

@@ -1,10 +1,15 @@
import { listPosts } from "@cms/db"
import { listPostsForLocale } from "@cms/db"
import Link from "next/link"
export const dynamic = "force-dynamic"
export default async function PublicNewsIndexPage() {
const posts = await listPosts()
type PublicNewsIndexPageProps = {
params: Promise<{ locale: string }>
}
export default async function PublicNewsIndexPage({ params }: PublicNewsIndexPageProps) {
const { locale } = await params
const posts = await listPostsForLocale(locale)
return (
<section className="mx-auto w-full max-w-4xl space-y-4 px-6 py-16">

View File

@@ -1,11 +1,13 @@
import { listPublicNavigation } from "@cms/db"
import { getLocale } from "next-intl/server"
import { Link } from "@/i18n/navigation"
import { LanguageSwitcher } from "./language-switcher"
export async function PublicSiteHeader() {
const navItems = await listPublicNavigation("header")
const locale = await getLocale()
const navItems = await listPublicNavigation("header", locale)
return (
<header className="border-b border-neutral-200 bg-white/80 backdrop-blur">