diff --git a/src/i18n/locales/de.ts b/src/i18n/locales/de.ts index 9146aaa..b8f24cb 100644 --- a/src/i18n/locales/de.ts +++ b/src/i18n/locales/de.ts @@ -335,6 +335,37 @@ const de: Partial> = { "con.commandLabel": "Befehl", "con.send": "Senden", "con.confirmRisky": "„{cmd}“ kann Dinge herunterfahren oder viele Datensätze ändern. Trotzdem senden?", + + // Server updates + "upd.act.create": "Neue Datei", + "upd.act.replace": "Aktualisiert", + "upd.act.merge-config": "Neue Einstellungen hinzugefügt", + "upd.act.skip": "Unverändert", + "upd.act.conflict": "Braucht deine Entscheidung", + "upd.updatedTo": "Auf Version {v} aktualisiert.", + "upd.confirmBack": "Zur vorherigen Version zurückkehren? Deine Charaktere und Konten werden nicht verändert.", + "upd.wentBack": "Zur vorherigen Version zurückgekehrt. Deine Daten wurden nicht angetastet.", + "upd.dialogTitle": "Wähle einen Update-Paketordner", + "upd.pendingBad": "Der aktualisierte Server ist nicht korrekt gestartet", + "upd.pendingUnfinished": "Ein früheres Update wurde nicht abgeschlossen", + "upd.safeBack": "Du kannst sicher zur vorherigen Version zurückkehren.", + "upd.backNote": "Das Zurückkehren stellt Programmdateien und Einstellungen wieder her. Charaktere und Konten werden nie automatisch zurückgesetzt.", + "upd.goBackTo": "Zu Version {v} zurückkehren", + "upd.goBackBefore": "Zur Version vor dem Update zurückkehren", + "upd.title": "Server-Updates", + "upd.text": "Updates werden auf Echtheit geprüft, vorher gesichert und können rückgängig gemacht werden.", + "upd.check": "Nach Updates suchen", + "upd.folderLabel": "Update-Paketordner", + "upd.folderHint": "Update-Paketordner (leer lassen für die offizielle Quelle)", + "upd.available": "Version {to} ist verfügbar", + "upd.availableFrom": "Version {to} ist verfügbar (du hast {from})", + "upd.summary": "Download {size} · {files} Datei(en) ändern sich", + "upd.summaryDb": "Download {size} · {files} Datei(en) ändern sich · {db} Datenbank-Update(s)", + "upd.conflict": "Diese Datei wurde außerhalb des CoA Server Managers geändert.", + "upd.keep": "Meine Datei behalten", + "upd.replace": "Durch Update ersetzen", + "upd.now": "Jetzt aktualisieren", + "upd.stopNote": "Der Server wird während des Updates gestoppt und danach zur Prüfung erneut gestartet.", }; export default de; diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index 221da12..68d7203 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -335,6 +335,37 @@ const en = { "con.commandLabel": "Command", "con.send": "Send", "con.confirmRisky": "“{cmd}” can shut things down or change many records. Send it anyway?", + + // Server updates + "upd.act.create": "New file", + "upd.act.replace": "Updated", + "upd.act.merge-config": "New settings added", + "upd.act.skip": "Unchanged", + "upd.act.conflict": "Needs your decision", + "upd.updatedTo": "Updated to version {v}.", + "upd.confirmBack": "Go back to the previous version? Your characters and accounts are not changed.", + "upd.wentBack": "Went back to the previous version. Your data was not touched.", + "upd.dialogTitle": "Choose an update package folder", + "upd.pendingBad": "The updated server did not start correctly", + "upd.pendingUnfinished": "An earlier update did not finish", + "upd.safeBack": "You can safely go back to the previous version.", + "upd.backNote": "Going back restores program files and settings. Characters and accounts are never rolled back automatically.", + "upd.goBackTo": "Go back to version {v}", + "upd.goBackBefore": "Go back to the version before the update", + "upd.title": "Server updates", + "upd.text": "Updates are checked for authenticity, backed up first, and can be undone.", + "upd.check": "Check for updates", + "upd.folderLabel": "Update package folder", + "upd.folderHint": "Update package folder (leave empty to use the official source)", + "upd.available": "Version {to} is available", + "upd.availableFrom": "Version {to} is available (you have {from})", + "upd.summary": "Download {size} · {files} file(s) change", + "upd.summaryDb": "Download {size} · {files} file(s) change · {db} database update(s)", + "upd.conflict": "This file was modified outside CoA Server Manager.", + "upd.keep": "Keep my file", + "upd.replace": "Replace with update", + "upd.now": "Update now", + "upd.stopNote": "The server is stopped during the update and started again to check that it works.", } as const; export default en; diff --git a/src/i18n/locales/es.ts b/src/i18n/locales/es.ts index 6174592..03554f6 100644 --- a/src/i18n/locales/es.ts +++ b/src/i18n/locales/es.ts @@ -335,6 +335,37 @@ const es: Partial> = { "con.commandLabel": "Comando", "con.send": "Enviar", "con.confirmRisky": "«{cmd}» puede apagar cosas o cambiar muchos registros. ¿Enviarlo de todos modos?", + + // Server updates + "upd.act.create": "Archivo nuevo", + "upd.act.replace": "Actualizado", + "upd.act.merge-config": "Ajustes nuevos añadidos", + "upd.act.skip": "Sin cambios", + "upd.act.conflict": "Requiere tu decisión", + "upd.updatedTo": "Actualizado a la versión {v}.", + "upd.confirmBack": "¿Volver a la versión anterior? Tus personajes y cuentas no se modifican.", + "upd.wentBack": "Se volvió a la versión anterior. Tus datos no se tocaron.", + "upd.dialogTitle": "Elige una carpeta de paquete de actualización", + "upd.pendingBad": "El servidor actualizado no se inició correctamente", + "upd.pendingUnfinished": "Una actualización anterior no terminó", + "upd.safeBack": "Puedes volver con seguridad a la versión anterior.", + "upd.backNote": "Volver restaura los archivos del programa y los ajustes. Los personajes y cuentas nunca se revierten automáticamente.", + "upd.goBackTo": "Volver a la versión {v}", + "upd.goBackBefore": "Volver a la versión anterior a la actualización", + "upd.title": "Actualizaciones del servidor", + "upd.text": "Las actualizaciones se comprueban, se respaldan antes y se pueden deshacer.", + "upd.check": "Buscar actualizaciones", + "upd.folderLabel": "Carpeta del paquete de actualización", + "upd.folderHint": "Carpeta del paquete de actualización (déjala vacía para usar la fuente oficial)", + "upd.available": "La versión {to} está disponible", + "upd.availableFrom": "La versión {to} está disponible (tienes {from})", + "upd.summary": "Descarga {size} · cambian {files} archivo(s)", + "upd.summaryDb": "Descarga {size} · cambian {files} archivo(s) · {db} actualización(es) de base de datos", + "upd.conflict": "Este archivo se modificó fuera de CoA Server Manager.", + "upd.keep": "Conservar mi archivo", + "upd.replace": "Reemplazar con la actualización", + "upd.now": "Actualizar ahora", + "upd.stopNote": "El servidor se detiene durante la actualización y se inicia de nuevo para comprobar que funciona.", }; export default es; diff --git a/src/i18n/locales/fr.ts b/src/i18n/locales/fr.ts index 765b44e..7e00d93 100644 --- a/src/i18n/locales/fr.ts +++ b/src/i18n/locales/fr.ts @@ -335,6 +335,37 @@ const fr: Partial> = { "con.commandLabel": "Commande", "con.send": "Envoyer", "con.confirmRisky": "« {cmd} » peut tout arrêter ou modifier de nombreux enregistrements. L’envoyer quand même ?", + + // Server updates + "upd.act.create": "Nouveau fichier", + "upd.act.replace": "Mis à jour", + "upd.act.merge-config": "Nouveaux paramètres ajoutés", + "upd.act.skip": "Inchangé", + "upd.act.conflict": "Nécessite votre décision", + "upd.updatedTo": "Mis à jour vers la version {v}.", + "upd.confirmBack": "Revenir à la version précédente ? Vos personnages et comptes ne sont pas modifiés.", + "upd.wentBack": "Retour à la version précédente effectué. Vos données n’ont pas été touchées.", + "upd.dialogTitle": "Choisissez un dossier de paquet de mise à jour", + "upd.pendingBad": "Le serveur mis à jour n’a pas démarré correctement", + "upd.pendingUnfinished": "Une mise à jour précédente ne s’est pas terminée", + "upd.safeBack": "Vous pouvez revenir en toute sécurité à la version précédente.", + "upd.backNote": "Le retour restaure les fichiers du programme et les paramètres. Les personnages et comptes ne sont jamais restaurés automatiquement.", + "upd.goBackTo": "Revenir à la version {v}", + "upd.goBackBefore": "Revenir à la version d’avant la mise à jour", + "upd.title": "Mises à jour du serveur", + "upd.text": "Les mises à jour sont vérifiées, sauvegardées au préalable et peuvent être annulées.", + "upd.check": "Rechercher des mises à jour", + "upd.folderLabel": "Dossier du paquet de mise à jour", + "upd.folderHint": "Dossier du paquet de mise à jour (laisser vide pour la source officielle)", + "upd.available": "La version {to} est disponible", + "upd.availableFrom": "La version {to} est disponible (vous avez {from})", + "upd.summary": "Téléchargement {size} · {files} fichier(s) modifié(s)", + "upd.summaryDb": "Téléchargement {size} · {files} fichier(s) modifié(s) · {db} mise(s) à jour de la base", + "upd.conflict": "Ce fichier a été modifié en dehors de CoA Server Manager.", + "upd.keep": "Garder mon fichier", + "upd.replace": "Remplacer par la mise à jour", + "upd.now": "Mettre à jour maintenant", + "upd.stopNote": "Le serveur est arrêté pendant la mise à jour puis redémarré pour vérifier qu’il fonctionne.", }; export default fr; diff --git a/src/i18n/locales/ru.ts b/src/i18n/locales/ru.ts index 2449af8..1e5c710 100644 --- a/src/i18n/locales/ru.ts +++ b/src/i18n/locales/ru.ts @@ -335,6 +335,37 @@ const ru: Partial> = { "con.commandLabel": "Команда", "con.send": "Отправить", "con.confirmRisky": "Команда «{cmd}» может что-то выключить или изменить много записей. Всё равно отправить?", + + // Server updates + "upd.act.create": "Новый файл", + "upd.act.replace": "Обновлён", + "upd.act.merge-config": "Добавлены новые настройки", + "upd.act.skip": "Без изменений", + "upd.act.conflict": "Нужно ваше решение", + "upd.updatedTo": "Обновлено до версии {v}.", + "upd.confirmBack": "Вернуться к предыдущей версии? Ваши персонажи и учётные записи не изменятся.", + "upd.wentBack": "Выполнен возврат к предыдущей версии. Ваши данные не затронуты.", + "upd.dialogTitle": "Выберите папку с пакетом обновления", + "upd.pendingBad": "Обновлённый сервер запустился некорректно", + "upd.pendingUnfinished": "Предыдущее обновление не завершилось", + "upd.safeBack": "Можно безопасно вернуться к предыдущей версии.", + "upd.backNote": "Возврат восстанавливает файлы программы и настройки. Персонажи и учётные записи автоматически не откатываются никогда.", + "upd.goBackTo": "Вернуться к версии {v}", + "upd.goBackBefore": "Вернуться к версии до обновления", + "upd.title": "Обновления сервера", + "upd.text": "Подлинность обновлений проверяется, перед ними делается резервная копия, и их можно отменить.", + "upd.check": "Проверить обновления", + "upd.folderLabel": "Папка с пакетом обновления", + "upd.folderHint": "Папка с пакетом обновления (оставьте пустым, чтобы использовать официальный источник)", + "upd.available": "Доступна версия {to}", + "upd.availableFrom": "Доступна версия {to} (у вас {from})", + "upd.summary": "Загрузка {size} · изменится файлов: {files}", + "upd.summaryDb": "Загрузка {size} · изменится файлов: {files} · обновлений базы данных: {db}", + "upd.conflict": "Этот файл был изменён вне CoA Server Manager.", + "upd.keep": "Оставить мой файл", + "upd.replace": "Заменить файлом из обновления", + "upd.now": "Обновить сейчас", + "upd.stopNote": "На время обновления сервер останавливается, а затем запускается снова для проверки его работы.", }; export default ru; diff --git a/src/screens/SettingsHome.tsx b/src/screens/SettingsHome.tsx index b69546e..9b4af71 100644 --- a/src/screens/SettingsHome.tsx +++ b/src/screens/SettingsHome.tsx @@ -8,15 +8,7 @@ import { Card } from "@/components/ui/card"; import { ClientCard } from "@/screens/ClientCard"; import { DiagnosticsCard } from "@/screens/DiagnosticsCard"; import { AboutCard } from "@/screens/AboutCard"; -import { LOCALES, useI18n } from "@/i18n"; - -const ACTION_TEXT: Record = { - create: "New file", - replace: "Updated", - "merge-config": "New settings added", - skip: "Unchanged", - conflict: "Needs your decision", -}; +import { LOCALES, useHuman, useI18n, type Key } from "@/i18n"; function mb(bytes: number) { return bytes >= 1 << 20 ? `${(bytes / (1 << 20)).toFixed(1)} MB` : `${Math.max(1, Math.round(bytes / 1024))} KB`; @@ -24,6 +16,7 @@ function mb(bytes: number) { export function SettingsHome({ serverId }: { serverId: string }) { const { t, locale, setLocale } = useI18n(); + const human = useHuman(); const [preview, setPreview] = useState(null); const [pending, setPending] = useState(null); const [busy, setBusy] = useState<"check" | "update" | "rollback" | null>(null); @@ -65,7 +58,7 @@ export function SettingsHome({ serverId }: { serverId: string }) { try { const out = await api.applyUpdate(serverId, choices, source.trim() || undefined); setPreview(null); - if (out.txn.state === "committed") setDone(`Updated to version ${out.txn.to_version}.`); + if (out.txn.state === "committed") setDone(t("upd.updatedTo", { v: out.txn.to_version ?? "" })); else setPending(out.txn); } catch (e) { setError(asUiError(e)); @@ -76,14 +69,14 @@ export function SettingsHome({ serverId }: { serverId: string }) { } } - async function rollback(t: UpdateTxn) { - if (!window.confirm("Go back to the previous version? Your characters and accounts are not changed.")) return; + async function rollback(txn: UpdateTxn) { + if (!window.confirm(t("upd.confirmBack"))) return; setBusy("rollback"); setError(null); try { - await api.rollbackUpdate(serverId, t.id); + await api.rollbackUpdate(serverId, txn.id); setPending(null); - setDone("Went back to the previous version. Your data was not touched."); + setDone(t("upd.wentBack")); } catch (e) { setError(asUiError(e)); } finally { @@ -92,7 +85,7 @@ export function SettingsHome({ serverId }: { serverId: string }) { } async function browse() { - const p = await open({ directory: true, multiple: false, title: "Choose an update package folder" }); + const p = await open({ directory: true, multiple: false, title: t("upd.dialogTitle") }); if (typeof p === "string") setSource(p); } @@ -104,13 +97,13 @@ export function SettingsHome({ serverId }: { serverId: string }) { {pending && (

- {pending.state === "needs-decision" ? "The updated server did not start correctly" : "An earlier update did not finish"} + {pending.state === "needs-decision" ? t("upd.pendingBad") : t("upd.pendingUnfinished")}

-

{pending.message ?? "You can safely go back to the previous version."}

-

Going back restores program files and settings. Characters and accounts are never rolled back automatically.

+

{pending.message ?? t("upd.safeBack")}

+

{t("upd.backNote")}

)} @@ -139,57 +132,58 @@ export function SettingsHome({ serverId }: { serverId: string }) { -

Server updates

-

Updates are checked for authenticity, backed up first, and can be undone.

+

{t("upd.title")}

+

{t("upd.text")}

{advanced && (
- setSource(e.target.value)} placeholder="Update package folder (leave empty to use the official source)" className="selectable flex-1 rounded-md border border-line bg-bg px-3 py-2 text-sm outline-none focus:border-gold" /> - + setSource(e.target.value)} placeholder={t("upd.folderHint")} className="selectable flex-1 rounded-md border border-line bg-bg px-3 py-2 text-sm outline-none focus:border-gold" /> +
)} {done &&

{done}

} {error && (

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

)} {preview && (

- Version {preview.to_version} is available{preview.from_version ? ` (you have ${preview.from_version})` : ""} + {preview.from_version ? t("upd.availableFrom", { to: preview.to_version, from: preview.from_version }) : t("upd.available", { to: preview.to_version })}

- Download {mb(preview.download_bytes)} · {preview.items.filter((i) => i.action !== "skip").length} file(s) change - {preview.migrations > 0 ? ` · ${preview.migrations} database update(s)` : ""} + {preview.migrations > 0 + ? t("upd.summaryDb", { size: mb(preview.download_bytes), files: preview.items.filter((i) => i.action !== "skip").length, db: preview.migrations }) + : t("upd.summary", { size: mb(preview.download_bytes), files: preview.items.filter((i) => i.action !== "skip").length })}

    {preview.items.filter((i) => i.action !== "skip").map((i) => (
  • {i.path} - {ACTION_TEXT[i.action]} + {t(`upd.act.${i.action}` as Key)}
    {i.action === "conflict" && (
    - This file was modified outside CoA Server Manager - This file was modified outside CoA Server Manager. + {t("upd.conflict")} + {t("upd.conflict")} {(["keep", "replace"] as const).map((c) => ( ))}
    @@ -199,9 +193,9 @@ export function SettingsHome({ serverId }: { serverId: string }) {
-

The server is stopped during the update and started again to check that it works.

+

{t("upd.stopNote")}

)}