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:
1 parent
1199176883
commit
e004dfedaf
47 files changed
+1740
-471
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import Link from "next/link";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { redirect } from "next/navigation";
|
||||
import { ContentCard } from "@/components/public/ui";
|
||||
import { auth } from "@/lib/auth";
|
||||
@@ -27,6 +28,7 @@ const PROVIDERS = [
|
||||
] as const;
|
||||
|
||||
export default async function ConnectionsPage() {
|
||||
const t = await getTranslations("pages.connections");
|
||||
const session = await auth();
|
||||
if (!session?.user?.id) redirect("/login");
|
||||
|
||||
@@ -53,23 +55,22 @@ export default async function ConnectionsPage() {
|
||||
return (
|
||||
<main style={{ display: "grid", gap: "1.5rem", maxWidth: 620, margin: "0 auto" }}>
|
||||
<p className="muted" style={{ margin: 0 }}>
|
||||
<Link href="/settings">← Settings</Link>
|
||||
<Link href="/settings">{t("backToSettings")}</Link>
|
||||
</p>
|
||||
|
||||
<ContentCard
|
||||
icon="🔗"
|
||||
title="Connected accounts"
|
||||
subtitle="Link a social account so you can sign in with one click"
|
||||
title={t("title")}
|
||||
subtitle={t("subtitle")}
|
||||
>
|
||||
<p className="muted" style={{ marginTop: 0 }}>
|
||||
We match it to your hotel account by e-mail, so use the address on file:{" "}
|
||||
{t("matchByEmail")}{" "}
|
||||
<strong>{session.user.name}</strong>.
|
||||
</p>
|
||||
|
||||
{lookupFailed ? (
|
||||
<p className="muted" style={{ marginBottom: 0 }}>
|
||||
We couldn't read your linked accounts right now. You can still connect below — your
|
||||
status will show once it's available.
|
||||
{t("lookupFailed")}
|
||||
</p>
|
||||
) : null}
|
||||
</ContentCard>
|
||||
@@ -84,10 +85,10 @@ export default async function ConnectionsPage() {
|
||||
title={p.label}
|
||||
subtitle={
|
||||
!p.available
|
||||
? "Not available on this hotel."
|
||||
? t("statusUnavailable")
|
||||
: isLinked
|
||||
? "Connected — sign in with this account."
|
||||
: "Not connected."
|
||||
? t("statusConnected")
|
||||
: t("statusNotConnected")
|
||||
}
|
||||
>
|
||||
{isLinked ? (
|
||||
@@ -96,7 +97,7 @@ export default async function ConnectionsPage() {
|
||||
style={{ cursor: "default", pointerEvents: "none" }}
|
||||
aria-disabled="true"
|
||||
>
|
||||
Connected
|
||||
{t("connected")}
|
||||
</span>
|
||||
) : p.available ? (
|
||||
// Plain link into NextAuth's built-in sign-in handler. Re-using
|
||||
@@ -108,7 +109,7 @@ export default async function ConnectionsPage() {
|
||||
callbackUrl,
|
||||
)}`}
|
||||
>
|
||||
Connect {p.label}
|
||||
{t("connectProvider", { provider: p.label })}
|
||||
</a>
|
||||
) : (
|
||||
<span
|
||||
@@ -116,7 +117,7 @@ export default async function ConnectionsPage() {
|
||||
style={{ cursor: "not-allowed", opacity: 0.55, pointerEvents: "none" }}
|
||||
aria-disabled="true"
|
||||
>
|
||||
Unavailable
|
||||
{t("unavailable")}
|
||||
</span>
|
||||
)}
|
||||
</ContentCard>
|
||||
@@ -125,8 +126,7 @@ export default async function ConnectionsPage() {
|
||||
</div>
|
||||
|
||||
<p className="muted" style={{ margin: 0 }}>
|
||||
Connecting takes you to the provider to authorise, then back here. If your social account's
|
||||
e-mail doesn't match a hotel account, you'll be returned to the login screen with a note.
|
||||
{t("footerNote")}
|
||||
</p>
|
||||
</main>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user