Use translations for emulator page (was hardcoded Italian)
Local Build and Deploy / deploy (push) Successful in 58s
Local Build and Deploy / deploy (push) Successful in 58s
This commit is contained in:
1 parent
5ae29e2a58
commit
8bf1aa2fa7
2 files changed
+12
-13
No files matched your search
@@ -1,3 +1,4 @@
|
|||||||
|
import { getTranslations } from "next-intl/server";
|
||||||
import { ExternalLink, Server } from "lucide-react";
|
import { ExternalLink, Server } from "lucide-react";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { EmulatorSettingsForm } from "@/components/admin/emulator-settings-form";
|
import { EmulatorSettingsForm } from "@/components/admin/emulator-settings-form";
|
||||||
@@ -6,9 +7,6 @@ import type { Prisma } from "@/generated/prisma/client";
|
|||||||
import { calcPagination } from "@/lib/admin-helpers";
|
import { calcPagination } from "@/lib/admin-helpers";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
// SQL `LIKE` patterns that capture the user-facing strings inside
|
|
||||||
// `emulator_settings`. Anything not matching is config (timeouts, ports, IDs)
|
|
||||||
// and lives in /admin/settings/emulator instead.
|
|
||||||
const TRANSLATION_KEY_PATTERNS = [
|
const TRANSLATION_KEY_PATTERNS = [
|
||||||
"commands.description.%",
|
"commands.description.%",
|
||||||
"commands.keys.%",
|
"commands.keys.%",
|
||||||
@@ -25,6 +23,7 @@ export default async function EmulatorTranslationsPage({
|
|||||||
}: {
|
}: {
|
||||||
searchParams: Promise<Record<string, string | undefined>>;
|
searchParams: Promise<Record<string, string | undefined>>;
|
||||||
}) {
|
}) {
|
||||||
|
const t = await getTranslations("pages.admin.translations.emulator");
|
||||||
const sp = await searchParams;
|
const sp = await searchParams;
|
||||||
const search = sp.search || "";
|
const search = sp.search || "";
|
||||||
const group = sp.group || "";
|
const group = sp.group || "";
|
||||||
@@ -54,8 +53,6 @@ export default async function EmulatorTranslationsPage({
|
|||||||
take: perPage,
|
take: perPage,
|
||||||
}),
|
}),
|
||||||
prisma.emulatorSettings.count({ where }),
|
prisma.emulatorSettings.count({ where }),
|
||||||
// Group chips reflect the WHOLE translation-pattern subset (so they don't
|
|
||||||
// disappear when you click one); we ignore the group/search filters here.
|
|
||||||
prisma.emulatorSettings.findMany({
|
prisma.emulatorSettings.findMany({
|
||||||
where: baseFilter,
|
where: baseFilter,
|
||||||
select: { key: true },
|
select: { key: true },
|
||||||
@@ -80,24 +77,20 @@ export default async function EmulatorTranslationsPage({
|
|||||||
<div>
|
<div>
|
||||||
<h1 className="text-2xl font-bold flex items-center gap-2">
|
<h1 className="text-2xl font-bold flex items-center gap-2">
|
||||||
<Server className="w-6 h-6" />
|
<Server className="w-6 h-6" />
|
||||||
Emulator
|
{t("title")}
|
||||||
</h1>
|
</h1>
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">{t("subtitle")}</p>
|
||||||
Sottoinsieme di <code className="text-xs">emulator_settings</code> con stringhe utente (comandi,
|
|
||||||
wordfilter, messaggi pet/matchmaking).
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<Button asChild variant="outline" size="sm">
|
<Button asChild variant="outline" size="sm">
|
||||||
<Link href="/admin/settings/emulator">
|
<Link href="/admin/settings/emulator">
|
||||||
<ExternalLink className="w-4 h-4 mr-1" />
|
<ExternalLink className="w-4 h-4 mr-1" />
|
||||||
Impostazioni complete
|
{t("fullSettings")}
|
||||||
</Link>
|
</Link>
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="rounded-md border bg-muted/40 px-3 py-2 text-xs text-muted-foreground">
|
<div className="rounded-md border bg-muted/40 px-3 py-2 text-xs text-muted-foreground">
|
||||||
Le impostazioni di configurazione (porte, timeout, ID) non compaiono qui — usa il link «Impostazioni
|
{t("infoBox")}
|
||||||
complete». Le modifiche salvate sono sincronizzate con l'emulatore via RCON.
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<EmulatorSettingsForm
|
<EmulatorSettingsForm
|
||||||
|
|||||||
@@ -2032,6 +2032,12 @@
|
|||||||
"cms": "CMS",
|
"cms": "CMS",
|
||||||
"client": "Client (Nitro)",
|
"client": "Client (Nitro)",
|
||||||
"emulator": "Emulator"
|
"emulator": "Emulator"
|
||||||
|
},
|
||||||
|
"emulator": {
|
||||||
|
"title": "Emulator",
|
||||||
|
"subtitle": "User-facing strings from emulator_settings (commands, wordfilter, pet/matchmaking messages).",
|
||||||
|
"infoBox": "Configuration settings (ports, timeouts, IDs) do not appear here — use the full settings link. Saved changes are synced to the emulator via RCON.",
|
||||||
|
"fullSettings": "Full settings"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
|
|||||||
Reference in new issue
Block a user