diff --git a/src/i18n/locales/de.ts b/src/i18n/locales/de.ts index a652b99..9146aaa 100644 --- a/src/i18n/locales/de.ts +++ b/src/i18n/locales/de.ts @@ -318,6 +318,23 @@ const de: Partial> = { "fr.copy": "Verbindungsdaten kopieren", "fr.pkg": "Freundepaket erstellen (zip)", "fr.pkgSaved": "Gespeichert: {path}", + + // Console + "con.title": "Konsole", + "con.tab.world": "Welt", + "con.tab.auth": "Anmeldung", + "con.tab.database": "Datenbank", + "con.tab.manager": "Manager", + "con.searchLabel": "Protokoll durchsuchen", + "con.search": "Suchen …", + "con.follow": "Mitverfolgen", + "con.copied": "Kopiert", + "con.copyErrors": "Fehler kopieren", + "con.empty": "Nichts anzuzeigen.", + "con.commandsNote": "Befehle gehen direkt an den laufenden Weltserver. Riskante (Herunterfahren, Löschen, Sperren) verlangen eine Bestätigung.", + "con.commandLabel": "Befehl", + "con.send": "Senden", + "con.confirmRisky": "„{cmd}“ kann Dinge herunterfahren oder viele Datensätze ändern. Trotzdem senden?", }; export default de; diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index 49b4ea6..221da12 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -318,6 +318,23 @@ const en = { "fr.copy": "Copy connection info", "fr.pkg": "Create friend package (zip)", "fr.pkgSaved": "Saved: {path}", + + // Console + "con.title": "Console", + "con.tab.world": "World", + "con.tab.auth": "Auth", + "con.tab.database": "Database", + "con.tab.manager": "Manager", + "con.searchLabel": "Search the log", + "con.search": "Search…", + "con.follow": "Follow", + "con.copied": "Copied", + "con.copyErrors": "Copy errors", + "con.empty": "Nothing to show.", + "con.commandsNote": "Commands go straight to the running world server. Risky ones (shutdown, deleting or banning) ask for confirmation.", + "con.commandLabel": "Command", + "con.send": "Send", + "con.confirmRisky": "“{cmd}” can shut things down or change many records. Send it anyway?", } as const; export default en; diff --git a/src/i18n/locales/es.ts b/src/i18n/locales/es.ts index 015e05d..6174592 100644 --- a/src/i18n/locales/es.ts +++ b/src/i18n/locales/es.ts @@ -318,6 +318,23 @@ const es: Partial> = { "fr.copy": "Copiar datos de conexión", "fr.pkg": "Crear paquete para amigo (zip)", "fr.pkgSaved": "Guardado: {path}", + + // Console + "con.title": "Consola", + "con.tab.world": "Mundo", + "con.tab.auth": "Acceso", + "con.tab.database": "Base de datos", + "con.tab.manager": "Manager", + "con.searchLabel": "Buscar en el registro", + "con.search": "Buscar…", + "con.follow": "Seguir", + "con.copied": "Copiado", + "con.copyErrors": "Copiar errores", + "con.empty": "Nada que mostrar.", + "con.commandsNote": "Los comandos van directamente al servidor del mundo en ejecución. Los arriesgados (apagar, borrar o vetar) piden confirmación.", + "con.commandLabel": "Comando", + "con.send": "Enviar", + "con.confirmRisky": "«{cmd}» puede apagar cosas o cambiar muchos registros. ¿Enviarlo de todos modos?", }; export default es; diff --git a/src/i18n/locales/fr.ts b/src/i18n/locales/fr.ts index c4f6691..765b44e 100644 --- a/src/i18n/locales/fr.ts +++ b/src/i18n/locales/fr.ts @@ -318,6 +318,23 @@ const fr: Partial> = { "fr.copy": "Copier les informations de connexion", "fr.pkg": "Créer le paquet pour ami (zip)", "fr.pkgSaved": "Enregistré : {path}", + + // Console + "con.title": "Console", + "con.tab.world": "Monde", + "con.tab.auth": "Connexion", + "con.tab.database": "Base de données", + "con.tab.manager": "Manager", + "con.searchLabel": "Rechercher dans le journal", + "con.search": "Rechercher…", + "con.follow": "Suivre", + "con.copied": "Copié", + "con.copyErrors": "Copier les erreurs", + "con.empty": "Rien à afficher.", + "con.commandsNote": "Les commandes vont directement au serveur de monde en cours d’exécution. Les commandes risquées (arrêt, suppression, bannissement) demandent confirmation.", + "con.commandLabel": "Commande", + "con.send": "Envoyer", + "con.confirmRisky": "« {cmd} » peut tout arrêter ou modifier de nombreux enregistrements. L’envoyer quand même ?", }; export default fr; diff --git a/src/i18n/locales/ru.ts b/src/i18n/locales/ru.ts index 31ce5b5..2449af8 100644 --- a/src/i18n/locales/ru.ts +++ b/src/i18n/locales/ru.ts @@ -318,6 +318,23 @@ const ru: Partial> = { "fr.copy": "Скопировать данные подключения", "fr.pkg": "Создать пакет для друга (zip)", "fr.pkgSaved": "Сохранено: {path}", + + // Console + "con.title": "Консоль", + "con.tab.world": "Мир", + "con.tab.auth": "Вход", + "con.tab.database": "База данных", + "con.tab.manager": "Менеджер", + "con.searchLabel": "Поиск по журналу", + "con.search": "Поиск…", + "con.follow": "Следить", + "con.copied": "Скопировано", + "con.copyErrors": "Скопировать ошибки", + "con.empty": "Показывать нечего.", + "con.commandsNote": "Команды отправляются прямо на запущенный игровой сервер. Рискованные (выключение, удаление, бан) требуют подтверждения.", + "con.commandLabel": "Команда", + "con.send": "Отправить", + "con.confirmRisky": "Команда «{cmd}» может что-то выключить или изменить много записей. Всё равно отправить?", }; export default ru; diff --git a/src/screens/ConsolePage.tsx b/src/screens/ConsolePage.tsx index a7d32e1..dfcef3d 100644 --- a/src/screens/ConsolePage.tsx +++ b/src/screens/ConsolePage.tsx @@ -3,17 +3,20 @@ import { api, asUiError, type ConsoleLine, type ConsoleSource, type UiError } fr import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; import { Card } from "@/components/ui/card"; +import { useHuman, useT, type Key } from "@/i18n"; -const TABS: { id: ConsoleSource; label: string }[] = [ - { id: "world", label: "World" }, - { id: "auth", label: "Auth" }, - { id: "database", label: "Database" }, - { id: "manager", label: "Manager" }, +const TABS: { id: ConsoleSource; label: Key }[] = [ + { id: "world", label: "con.tab.world" }, + { id: "auth", label: "con.tab.auth" }, + { id: "database", label: "con.tab.database" }, + { id: "manager", label: "con.tab.manager" }, ]; const TONE = { info: "text-ink/80", warn: "text-warn", error: "text-bad" } as const; export function ConsolePage({ serverId }: { serverId: string }) { + const t = useT(); + const human = useHuman(); const [tab, setTab] = useState("world"); const [filter, setFilter] = useState(""); const [lines, setLines] = useState([]); @@ -38,8 +41,8 @@ export function ConsolePage({ serverId }: { serverId: string }) { useEffect(() => { void load(); if (!live) return; - const t = setInterval(load, 2000); - return () => clearInterval(t); + const iv = setInterval(load, 2000); + return () => clearInterval(iv); }, [load, live]); useEffect(() => { @@ -51,8 +54,8 @@ export function ConsolePage({ serverId }: { serverId: string }) { setReply(null); try { const risk = await api.consoleRisk(cmd); - if (risk === "dangerous" && !window.confirm(`“${cmd}” can shut things down or change many records. Send it anyway?`)) return; - setReply((await api.consoleCommand(serverId, cmd, risk === "dangerous")) || "(no output)"); + if (risk === "dangerous" && !window.confirm(t("con.confirmRisky", { cmd }))) return; + setReply((await api.consoleCommand(serverId, cmd, risk === "dangerous")) || t("common.noOutput")); setCmd(""); } catch (e) { setError(asUiError(e)); @@ -63,32 +66,32 @@ export function ConsolePage({ serverId }: { serverId: string }) { return (
-

Console

-

What is the server doing?

+

{t("con.title")}

+

{t("q.console")}

- {TABS.map((t) => ( + {TABS.map((tb) => ( ))}
setFilter(e.target.value)} className="ml-auto w-56 rounded-md border border-line bg-bg px-3 py-1.5 text-sm outline-none focus:border-gold" />
- {missing ?

{missing}

: lines.length === 0 ?

Nothing to show.

: lines.map((l, i) => ( + {missing ?

{missing}

: lines.length === 0 ?

{t("con.empty")}

: lines.map((l, i) => (
{l.level !== "info" && {l.level}: } {l.text} @@ -111,13 +114,13 @@ export function ConsolePage({ serverId }: { serverId: string }) { {tab === "world" && ( -

Commands go straight to the running world server. Risky ones (shutdown, deleting or banning) ask for confirmation.

+

{t("con.commandsNote")}

{ e.preventDefault(); void send(); }}> - setCmd(e.target.value)} placeholder="server info" className="selectable flex-1 rounded-md border border-line bg-bg px-3 py-2 font-mono text-sm outline-none focus:border-gold" /> - + setCmd(e.target.value)} placeholder="server info" className="selectable flex-1 rounded-md border border-line bg-bg px-3 py-2 font-mono text-sm outline-none focus:border-gold" /> +
{reply &&
{reply}
} - {error &&

{error.human.code === "unknown" ? error.technical : error.human.message}

} + {error &&

{error.human.code === "unknown" ? error.technical : human(error.human).message}

}
)}