i18n: translate all public page bodies (EN + IT)

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).
This commit is contained in:
Simo committed 2026-06-28 20:40:06 +02:00
1 parent 1199176883
commit e004dfedaf
47 files changed
+1740 -471

No files matched your search

+11 -11
View File
@@ -1,3 +1,4 @@
import { getTranslations } from "next-intl/server";
import { redirect } from "next/navigation";
import { applyTeam } from "@/actions/applications";
import { ContentCard, EmptyState } from "@/components/public/ui";
@@ -14,6 +15,8 @@ export default async function ApplyTeamPage() {
const session = await auth();
if (!session?.user?.id) redirect("/login");
const t = await getTranslations("pages.applyTeam");
const userId = Number(session.user.id);
const hotelName = (await siteSettings.get("hotel_name", "Atom")) ?? "Atom";
@@ -39,16 +42,13 @@ export default async function ApplyTeamPage() {
<main style={{ display: "grid", gap: "1.5rem" }}>
<ContentCard
icon="🤝"
title={`Apply for the ${hotelName} team`}
subtitle="We open team applications periodically. If you see a team you fit, do not hesitate to apply!"
title={t("title", { hotel: hotelName })}
subtitle={t("subtitle")}
/>
{teams.length === 0 ? (
<ContentCard icon="🤝" title="No team positions open">
<EmptyState icon="🤝">
There are currently no open team positions. Please come back later to check for new
openings. Thank you!
</EmptyState>
<ContentCard icon="🤝" title={t("noPositionsTitle")}>
<EmptyState icon="🤝">{t("noPositionsBody")}</EmptyState>
</ContentCard>
) : (
<div className="card-grid sm-2">
@@ -89,7 +89,7 @@ export default async function ApplyTeamPage() {
disabled
style={{ width: "100%" }}
>
Your application is pending
{t("pending")}
</button>
) : (
<form action={applyTeam}>
@@ -97,7 +97,7 @@ export default async function ApplyTeamPage() {
is re-read from the session inside the action. */}
<input type="hidden" name="teamId" value={String(team.id)} />
<label htmlFor={`content-${team.id}`} className="muted">
About you
{t("aboutYou")}
</label>
<textarea
id={`content-${team.id}`}
@@ -105,11 +105,11 @@ export default async function ApplyTeamPage() {
required
minLength={10}
rows={5}
placeholder={`Tell us why you'd be a great fit for ${team.rankName}…`}
placeholder={t("aboutPlaceholder", { rank: team.rankName })}
style={{ width: "100%", margin: "0.4rem 0 0.75rem", resize: "vertical" }}
/>
<button type="submit" className="btn btn-primary" style={{ width: "100%" }}>
Apply for {team.rankName}
{t("applyFor", { rank: team.rankName })}
</button>
</form>
)}