Use translations for emulator page (was hardcoded Italian)

This commit is contained in:
openhands committed 2026-07-12 23:14:35 +02:00
1 parent 5ae29e2a58
commit 8bf1aa2fa7
2 files changed
+12 -13

No files matched your search

+6 -13
View File
@@ -1,3 +1,4 @@
import { getTranslations } from "next-intl/server";
import { ExternalLink, Server } from "lucide-react";
import Link from "next/link";
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 { 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 = [
"commands.description.%",
"commands.keys.%",
@@ -25,6 +23,7 @@ export default async function EmulatorTranslationsPage({
}: {
searchParams: Promise<Record<string, string | undefined>>;
}) {
const t = await getTranslations("pages.admin.translations.emulator");
const sp = await searchParams;
const search = sp.search || "";
const group = sp.group || "";
@@ -54,8 +53,6 @@ export default async function EmulatorTranslationsPage({
take: perPage,
}),
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({
where: baseFilter,
select: { key: true },
@@ -80,24 +77,20 @@ export default async function EmulatorTranslationsPage({
<div>
<h1 className="text-2xl font-bold flex items-center gap-2">
<Server className="w-6 h-6" />
Emulator
{t("title")}
</h1>
<p className="text-sm text-muted-foreground">
Sottoinsieme di <code className="text-xs">emulator_settings</code> con stringhe utente (comandi,
wordfilter, messaggi pet/matchmaking).
</p>
<p className="text-sm text-muted-foreground">{t("subtitle")}</p>
</div>
<Button asChild variant="outline" size="sm">
<Link href="/admin/settings/emulator">
<ExternalLink className="w-4 h-4 mr-1" />
Impostazioni complete
{t("fullSettings")}
</Link>
</Button>
</div>
<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
complete». Le modifiche salvate sono sincronizzate con l&apos;emulatore via RCON.
{t("infoBox")}
</div>
<EmulatorSettingsForm
+6
View File
@@ -2032,6 +2032,12 @@
"cms": "CMS",
"client": "Client (Nitro)",
"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": {