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 { beginTwoFactor, confirmTwoFactor, disableTwoFactor } from "@/actions/twofactor";
|
||||
import { ContentCard } from "@/components/public/ui";
|
||||
@@ -16,6 +17,7 @@ export default async function TwoFactorPage({
|
||||
}: {
|
||||
searchParams: Promise<{ error?: string; enabled?: string; disabled?: string }>;
|
||||
}) {
|
||||
const t = await getTranslations("pages.settings2fa");
|
||||
const session = await auth();
|
||||
if (!session?.user?.id) redirect("/login");
|
||||
const sp = await searchParams;
|
||||
@@ -50,52 +52,52 @@ export default async function TwoFactorPage({
|
||||
return (
|
||||
<main style={{ display: "grid", gap: "1.5rem", maxWidth: 560, margin: "0 auto" }}>
|
||||
<p className="muted" style={{ margin: 0 }}>
|
||||
<Link href="/settings">← Settings</Link>
|
||||
<Link href="/settings">{t("backToSettings")}</Link>
|
||||
</p>
|
||||
|
||||
<ContentCard
|
||||
icon="🔒"
|
||||
title="Two-factor authentication"
|
||||
subtitle="Add a second layer of security with an authenticator app"
|
||||
title={t("title")}
|
||||
subtitle={t("subtitle")}
|
||||
>
|
||||
{sp.enabled ? (
|
||||
<p style={{ color: "var(--color-accent)", marginTop: 0 }}>2FA is now enabled. 🔒</p>
|
||||
<p style={{ color: "var(--color-accent)", marginTop: 0 }}>{t("nowEnabled")}</p>
|
||||
) : null}
|
||||
{sp.disabled ? (
|
||||
<p className="muted" style={{ marginTop: 0 }}>
|
||||
2FA has been disabled.
|
||||
{t("disabledNotice")}
|
||||
</p>
|
||||
) : null}
|
||||
{sp.error === "badcode" ? (
|
||||
<p style={{ color: "var(--color-danger)", marginTop: 0 }}>
|
||||
That code wasn't valid — try again.
|
||||
{t("badCode")}
|
||||
</p>
|
||||
) : null}
|
||||
|
||||
{!hasAppKey ? (
|
||||
<p style={{ margin: 0 }}>
|
||||
2FA is unavailable until <code>APP_KEY</code> is configured (the same Laravel
|
||||
<code> APP_KEY</code> as your AtomCMS install, so existing secrets stay readable).
|
||||
{t("noAppKeyPrefix")} <code>APP_KEY</code> {t("noAppKeyMiddle")}
|
||||
<code> APP_KEY</code> {t("noAppKeySuffix")}
|
||||
</p>
|
||||
) : enabled ? (
|
||||
<>
|
||||
<p style={{ marginTop: 0 }}>
|
||||
<strong>2FA is enabled</strong> on your account.
|
||||
<strong>{t("isEnabled")}</strong> {t("onYourAccount")}
|
||||
</p>
|
||||
<form action={disableTwoFactor}>
|
||||
<button type="submit" className="btn btn-danger">
|
||||
Disable 2FA
|
||||
{t("disable")}
|
||||
</button>
|
||||
</form>
|
||||
</>
|
||||
) : pending ? (
|
||||
<>
|
||||
<h3 style={{ marginTop: 0 }}>Scan or enter this key</h3>
|
||||
<h3 style={{ marginTop: 0 }}>{t("scanOrEnter")}</h3>
|
||||
<p className="muted" style={{ marginTop: 0 }}>
|
||||
Add this to Google Authenticator / Authy, then enter the 6-digit code to confirm.
|
||||
{t("scanInstructions")}
|
||||
</p>
|
||||
<p>
|
||||
Manual key: <code style={{ userSelect: "all" }}>{secret}</code>
|
||||
{t("manualKey")} <code style={{ userSelect: "all" }}>{secret}</code>
|
||||
</p>
|
||||
<p className="muted" style={{ wordBreak: "break-all", fontSize: "0.8rem" }}>
|
||||
{uri}
|
||||
@@ -104,20 +106,20 @@ export default async function TwoFactorPage({
|
||||
action={confirmTwoFactor}
|
||||
style={{ display: "flex", gap: "0.5rem", marginTop: "0.5rem" }}
|
||||
>
|
||||
<input name="code" placeholder="6-digit code" inputMode="numeric" required />
|
||||
<input name="code" placeholder={t("codePlaceholder")} inputMode="numeric" required />
|
||||
<button type="submit" className="btn btn-primary">
|
||||
Confirm
|
||||
{t("confirm")}
|
||||
</button>
|
||||
</form>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<p style={{ marginTop: 0 }}>
|
||||
Add a second layer of security with an authenticator app.
|
||||
{t("enableIntro")}
|
||||
</p>
|
||||
<form action={beginTwoFactor}>
|
||||
<button type="submit" className="btn btn-primary">
|
||||
Enable 2FA
|
||||
{t("enable")}
|
||||
</button>
|
||||
</form>
|
||||
</>
|
||||
|
||||
Reference in new issue
Block a user