Internationalised the ~44 public pages with next-intl (the shell was already translated). Each page now pulls its copy from a "pages.<slug>" namespace via getTranslations (server) / useTranslations (client); the EN + IT catalogs were authored by parallel agents and merged centrally, with natural Italian (ICU plurals) and it backfilled from en for any gap. request.ts gained getMessageFallback/onError so a missing key degrades to the English value, never a raw key. Behaviour unchanged (only display text moved to t() calls; queries, actions, fields, ContentCard structure preserved). Verified on the prod server: with NEXT_LOCALE=it, home/community/staff/news/shop/rankings all render Italian copy, no raw-key leakage; English unchanged. The nav language switcher toggles EN/IT live. tsc 0, vitest 49/49, next build 0. Admin pages intentionally left in English (staff tooling).
81 lines
1.8 KiB
TypeScript
81 lines
1.8 KiB
TypeScript
import { useTranslations } from "next-intl";
|
|
import Link from "next/link";
|
|
import { ContentCard } from "@/components/public/ui";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export const metadata = { title: "Community" };
|
|
|
|
const LINKS = [
|
|
{
|
|
key: "rankings",
|
|
href: "/rankings",
|
|
icon: "🏆",
|
|
},
|
|
{
|
|
key: "staff",
|
|
href: "/staff",
|
|
icon: "🛡️",
|
|
},
|
|
{
|
|
key: "news",
|
|
href: "/news",
|
|
icon: "📰",
|
|
},
|
|
{
|
|
key: "photos",
|
|
href: "/photos",
|
|
icon: "📸",
|
|
},
|
|
{
|
|
key: "guilds",
|
|
href: "/guilds",
|
|
icon: "🚪",
|
|
},
|
|
{
|
|
key: "leaderboards",
|
|
href: "/leaderboard",
|
|
icon: "📊",
|
|
},
|
|
];
|
|
|
|
export default function CommunityPage() {
|
|
const t = useTranslations("pages.community");
|
|
|
|
return (
|
|
<main style={{ display: "grid", gap: "1.5rem" }}>
|
|
<ContentCard
|
|
icon="🌍"
|
|
title={t("title")}
|
|
subtitle={t("subtitle")}
|
|
/>
|
|
|
|
<div className="card-grid sm-2 lg-3">
|
|
{LINKS.map((l) => (
|
|
<Link
|
|
key={l.href}
|
|
href={l.href}
|
|
className="content-card hover-lift"
|
|
style={{ color: "inherit", textDecoration: "none" }}
|
|
>
|
|
<div className="content-card-head">
|
|
<span className="content-card-icon" aria-hidden>
|
|
{l.icon}
|
|
</span>
|
|
<div className="content-card-head-text">
|
|
<p className="content-card-title">{t(`links.${l.key}.title`)}</p>
|
|
</div>
|
|
</div>
|
|
<div className="content-card-body">
|
|
<p className="muted" style={{ margin: "0 0 0.75rem" }}>
|
|
{t(`links.${l.key}.text`)}
|
|
</p>
|
|
<span className="btn btn-outline">{t("open")}</span>
|
|
</div>
|
|
</Link>
|
|
))}
|
|
</div>
|
|
</main>
|
|
);
|
|
}
|