diff --git a/src/i18n/locales/de.ts b/src/i18n/locales/de.ts index 3d7b7f0..b86b0d2 100644 --- a/src/i18n/locales/de.ts +++ b/src/i18n/locales/de.ts @@ -98,6 +98,55 @@ const de: Partial> = { "err.path_rejected.message": "Der angeforderte Dateipfad liegt außerhalb des Serverordners.", "err.unknown.title": "Etwas ist schiefgelaufen", "err.unknown.message": "Siehe die technischen Details.", + + // Import server + "import.title": "Vorhandenen Server hinzufügen", + "import.subtitle": "Wähle den Ordner, aus dem dein Server läuft. Er wird nur gelesen.", + "import.dialogTitle": "Serverordner auswählen", + "import.choose": "Ordner wählen …", + "import.chooseAnother": "Anderen Ordner wählen", + "import.looking": "Server wird untersucht …", + "import.healthy.title": "Vorhandener Server erkannt", + "import.healthy.text": "Alles, was zum Betrieb dieses Servers nötig ist, wurde gefunden.", + "import.partial.title": "Server teilweise gefunden", + "import.partial.text": "Einige Teile fehlen. Du kannst ihn trotzdem hinzufügen; es wird nichts automatisch repariert.", + "import.custom.title": "Angepasster Server erkannt", + "import.custom.text": "Dieser Build wird nicht erkannt. Einige Update- und Installationsfunktionen sind deaktiviert.", + "import.incompatible.title": "Das ist kein Serverordner", + "import.incompatible.text": "Wähle den Ordner, der Core, Data und mysql (oder deine worldserver.exe) enthält.", + "import.techDetails": "Technische Details anzeigen", + "import.detected": "Erkannt", + "import.notInstalled": "Nicht installiert", + "import.notFound": "Nicht gefunden", + "import.noChanges": "Beim Import werden keine Dateien verändert.", + "import.add": "Server hinzufügen", + + // Install server + "install.title": "Neuen Server installieren", + "install.subtitle": "Wähle einen Ordner oder behalte den vorgeschlagenen. Alles andere wird für dich eingerichtet.", + "install.installTo": "Installieren nach", + "install.browse": "Durchsuchen …", + "install.dialogTitle": "Wähle den Installationsort für deinen Server", + "install.pkgDialogTitle": "Wähle einen Serverpaket-Ordner", + "install.ready": "Dieser Ordner ist bereit. {gb} GB frei.", + "install.failedTitle": "Die Installation konnte nicht abgeschlossen werden", + "install.nothingInstalled": "Es wurde nichts installiert. Du kannst es erneut versuchen; heruntergeladene Dateien bleiben erhalten.", + "install.showTech": "Technische Details anzeigen", + "install.hideTech": "Technische Details ausblenden", + "install.advanced": "Erweitert", + "install.localPkg": "Aus einem lokalen Paketordner installieren statt herunterzuladen", + "install.localPkgHint": "(leer lassen zum Herunterladen)", + "install.button": "Installieren", + "install.progressTitle": "Server wird vorbereitet", + "install.progressText": "Das kann einige Minuten dauern. Du kannst dieses Fenster geöffnet lassen.", + "install.step.checking": "Computer wird geprüft", + "install.step.downloading": "Server wird heruntergeladen", + "install.step.unpacking": "Entpacken", + "install.step.database": "Datenbank wird vorbereitet", + "install.step.finishing": "Abschluss", + "install.doneTitle": "Dein Server ist bereit", + "install.doneText": "Alles ist installiert. Starte ihn auf dem nächsten Bildschirm.", + "install.open": "MEINEN SERVER ÖFFNEN", }; export default de; diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index 0596972..a27443f 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -98,6 +98,55 @@ const en = { "err.path_rejected.message": "The requested file location is outside the server folder.", "err.unknown.title": "Something went wrong", "err.unknown.message": "See the technical details.", + + // Import server + "import.title": "Add an existing server", + "import.subtitle": "Pick the folder your server runs from. It will only be read.", + "import.dialogTitle": "Choose your server folder", + "import.choose": "Choose folder…", + "import.chooseAnother": "Choose another folder", + "import.looking": "Looking at your server…", + "import.healthy.title": "Existing server detected", + "import.healthy.text": "Everything needed to run this server was found.", + "import.partial.title": "Server partly found", + "import.partial.text": "Some parts are missing. You can still add it; nothing will be fixed automatically.", + "import.custom.title": "Custom server detected", + "import.custom.text": "This build is not recognised. Some update and install features will be disabled.", + "import.incompatible.title": "This is not a server folder", + "import.incompatible.text": "Choose the folder that contains Core, Data and mysql (or your worldserver.exe).", + "import.techDetails": "Show technical details", + "import.detected": "Detected", + "import.notInstalled": "Not installed", + "import.notFound": "Not found", + "import.noChanges": "No files will be changed during import.", + "import.add": "Add server", + + // Install server + "install.title": "Install a new server", + "install.subtitle": "Choose a folder, or keep the suggested one. Everything else is set up for you.", + "install.installTo": "Install to", + "install.browse": "Browse…", + "install.dialogTitle": "Choose where to install your server", + "install.pkgDialogTitle": "Choose a server package folder", + "install.ready": "This folder is ready. {gb} GB free.", + "install.failedTitle": "The installation could not finish", + "install.nothingInstalled": "Nothing was installed. You can try again; downloaded files are kept.", + "install.showTech": "Show technical details", + "install.hideTech": "Hide technical details", + "install.advanced": "Advanced", + "install.localPkg": "Install from a local package folder instead of downloading", + "install.localPkgHint": "(leave empty to download)", + "install.button": "Install", + "install.progressTitle": "Preparing your server", + "install.progressText": "This can take a few minutes. You can leave this window open.", + "install.step.checking": "Checking your computer", + "install.step.downloading": "Downloading server", + "install.step.unpacking": "Unpacking", + "install.step.database": "Preparing database", + "install.step.finishing": "Finishing", + "install.doneTitle": "Your server is ready", + "install.doneText": "Everything is installed. Start it from the next screen.", + "install.open": "OPEN MY SERVER", } as const; export default en; diff --git a/src/i18n/locales/es.ts b/src/i18n/locales/es.ts index 03e1e12..e4aa90e 100644 --- a/src/i18n/locales/es.ts +++ b/src/i18n/locales/es.ts @@ -98,6 +98,55 @@ const es: Partial> = { "err.path_rejected.message": "La ubicación solicitada está fuera de la carpeta del servidor.", "err.unknown.title": "Algo salió mal", "err.unknown.message": "Consulta los detalles técnicos.", + + // Import server + "import.title": "Añadir un servidor existente", + "import.subtitle": "Elige la carpeta desde la que se ejecuta tu servidor. Solo se leerá.", + "import.dialogTitle": "Elige la carpeta del servidor", + "import.choose": "Elegir carpeta…", + "import.chooseAnother": "Elegir otra carpeta", + "import.looking": "Examinando tu servidor…", + "import.healthy.title": "Servidor existente detectado", + "import.healthy.text": "Se encontró todo lo necesario para ejecutar este servidor.", + "import.partial.title": "Servidor encontrado parcialmente", + "import.partial.text": "Faltan algunas partes. Aun así puedes añadirlo; no se corregirá nada automáticamente.", + "import.custom.title": "Servidor personalizado detectado", + "import.custom.text": "Esta versión no se reconoce. Algunas funciones de actualización e instalación estarán desactivadas.", + "import.incompatible.title": "Esta no es una carpeta de servidor", + "import.incompatible.text": "Elige la carpeta que contiene Core, Data y mysql (o tu worldserver.exe).", + "import.techDetails": "Mostrar detalles técnicos", + "import.detected": "Detectado", + "import.notInstalled": "No instalado", + "import.notFound": "No encontrado", + "import.noChanges": "No se modificará ningún archivo durante la importación.", + "import.add": "Añadir servidor", + + // Install server + "install.title": "Instalar un servidor nuevo", + "install.subtitle": "Elige una carpeta o mantén la sugerida. Todo lo demás se configura por ti.", + "install.installTo": "Instalar en", + "install.browse": "Examinar…", + "install.dialogTitle": "Elige dónde instalar tu servidor", + "install.pkgDialogTitle": "Elige una carpeta de paquete del servidor", + "install.ready": "Esta carpeta está lista. {gb} GB libres.", + "install.failedTitle": "La instalación no pudo terminar", + "install.nothingInstalled": "No se instaló nada. Puedes intentarlo de nuevo; los archivos descargados se conservan.", + "install.showTech": "Mostrar detalles técnicos", + "install.hideTech": "Ocultar detalles técnicos", + "install.advanced": "Avanzado", + "install.localPkg": "Instalar desde una carpeta de paquete local en lugar de descargar", + "install.localPkgHint": "(déjalo vacío para descargar)", + "install.button": "Instalar", + "install.progressTitle": "Preparando tu servidor", + "install.progressText": "Esto puede tardar unos minutos. Puedes dejar esta ventana abierta.", + "install.step.checking": "Comprobando tu equipo", + "install.step.downloading": "Descargando el servidor", + "install.step.unpacking": "Descomprimiendo", + "install.step.database": "Preparando la base de datos", + "install.step.finishing": "Finalizando", + "install.doneTitle": "Tu servidor está listo", + "install.doneText": "Todo está instalado. Inícialo desde la siguiente pantalla.", + "install.open": "ABRIR MI SERVIDOR", }; export default es; diff --git a/src/i18n/locales/fr.ts b/src/i18n/locales/fr.ts index 2f174b1..153d926 100644 --- a/src/i18n/locales/fr.ts +++ b/src/i18n/locales/fr.ts @@ -98,6 +98,55 @@ const fr: Partial> = { "err.path_rejected.message": "L’emplacement demandé est en dehors du dossier du serveur.", "err.unknown.title": "Une erreur s’est produite", "err.unknown.message": "Consultez les détails techniques.", + + // Import server + "import.title": "Ajouter un serveur existant", + "import.subtitle": "Choisissez le dossier depuis lequel votre serveur fonctionne. Il sera seulement lu.", + "import.dialogTitle": "Choisissez le dossier du serveur", + "import.choose": "Choisir le dossier…", + "import.chooseAnother": "Choisir un autre dossier", + "import.looking": "Analyse de votre serveur…", + "import.healthy.title": "Serveur existant détecté", + "import.healthy.text": "Tout ce qui est nécessaire pour faire fonctionner ce serveur a été trouvé.", + "import.partial.title": "Serveur partiellement trouvé", + "import.partial.text": "Certaines parties manquent. Vous pouvez quand même l’ajouter ; rien ne sera réparé automatiquement.", + "import.custom.title": "Serveur personnalisé détecté", + "import.custom.text": "Cette version n’est pas reconnue. Certaines fonctions de mise à jour et d’installation seront désactivées.", + "import.incompatible.title": "Ce n’est pas un dossier de serveur", + "import.incompatible.text": "Choisissez le dossier qui contient Core, Data et mysql (ou votre worldserver.exe).", + "import.techDetails": "Afficher les détails techniques", + "import.detected": "Détecté", + "import.notInstalled": "Non installé", + "import.notFound": "Introuvable", + "import.noChanges": "Aucun fichier ne sera modifié pendant l’importation.", + "import.add": "Ajouter le serveur", + + // Install server + "install.title": "Installer un nouveau serveur", + "install.subtitle": "Choisissez un dossier ou gardez celui proposé. Le reste est configuré pour vous.", + "install.installTo": "Installer dans", + "install.browse": "Parcourir…", + "install.dialogTitle": "Choisissez où installer votre serveur", + "install.pkgDialogTitle": "Choisissez un dossier de paquet serveur", + "install.ready": "Ce dossier est prêt. {gb} Go libres.", + "install.failedTitle": "L’installation n’a pas pu se terminer", + "install.nothingInstalled": "Rien n’a été installé. Vous pouvez réessayer ; les fichiers téléchargés sont conservés.", + "install.showTech": "Afficher les détails techniques", + "install.hideTech": "Masquer les détails techniques", + "install.advanced": "Avancé", + "install.localPkg": "Installer depuis un dossier de paquet local au lieu de télécharger", + "install.localPkgHint": "(laisser vide pour télécharger)", + "install.button": "Installer", + "install.progressTitle": "Préparation de votre serveur", + "install.progressText": "Cela peut prendre quelques minutes. Vous pouvez laisser cette fenêtre ouverte.", + "install.step.checking": "Vérification de votre ordinateur", + "install.step.downloading": "Téléchargement du serveur", + "install.step.unpacking": "Décompression", + "install.step.database": "Préparation de la base de données", + "install.step.finishing": "Finalisation", + "install.doneTitle": "Votre serveur est prêt", + "install.doneText": "Tout est installé. Démarrez-le depuis l’écran suivant.", + "install.open": "OUVRIR MON SERVEUR", }; export default fr; diff --git a/src/i18n/locales/ru.ts b/src/i18n/locales/ru.ts index aaeb951..410c88b 100644 --- a/src/i18n/locales/ru.ts +++ b/src/i18n/locales/ru.ts @@ -98,6 +98,55 @@ const ru: Partial> = { "err.path_rejected.message": "Запрошенный файл находится за пределами папки сервера.", "err.unknown.title": "Что-то пошло не так", "err.unknown.message": "Смотрите технические подробности.", + + // Import server + "import.title": "Добавить существующий сервер", + "import.subtitle": "Выберите папку, из которой запускается ваш сервер. Она будет только прочитана.", + "import.dialogTitle": "Выберите папку сервера", + "import.choose": "Выбрать папку…", + "import.chooseAnother": "Выбрать другую папку", + "import.looking": "Изучаю ваш сервер…", + "import.healthy.title": "Найден существующий сервер", + "import.healthy.text": "Найдено всё необходимое для запуска этого сервера.", + "import.partial.title": "Сервер найден частично", + "import.partial.text": "Некоторых частей не хватает. Сервер всё равно можно добавить; автоматически ничего исправляться не будет.", + "import.custom.title": "Найден нестандартный сервер", + "import.custom.text": "Эта сборка не распознана. Часть функций обновления и установки будет отключена.", + "import.incompatible.title": "Это не папка сервера", + "import.incompatible.text": "Выберите папку, в которой лежат Core, Data и mysql (или ваш worldserver.exe).", + "import.techDetails": "Показать технические подробности", + "import.detected": "Найдено", + "import.notInstalled": "Не установлено", + "import.notFound": "Не найдено", + "import.noChanges": "При импорте никакие файлы не изменяются.", + "import.add": "Добавить сервер", + + // Install server + "install.title": "Установка нового сервера", + "install.subtitle": "Выберите папку или оставьте предложенную. Всё остальное настроится само.", + "install.installTo": "Куда установить", + "install.browse": "Обзор…", + "install.dialogTitle": "Выберите, куда установить сервер", + "install.pkgDialogTitle": "Выберите папку с пакетом сервера", + "install.ready": "Папка подходит. Свободно {gb} ГБ.", + "install.failedTitle": "Не удалось завершить установку", + "install.nothingInstalled": "Ничего не установлено. Можно попробовать ещё раз; скачанные файлы сохранены.", + "install.showTech": "Показать технические подробности", + "install.hideTech": "Скрыть технические подробности", + "install.advanced": "Дополнительно", + "install.localPkg": "Установить из локальной папки с пакетом вместо скачивания", + "install.localPkgHint": "(оставьте пустым, чтобы скачать)", + "install.button": "Установить", + "install.progressTitle": "Подготовка сервера", + "install.progressText": "Это может занять несколько минут. Окно можно не закрывать.", + "install.step.checking": "Проверка компьютера", + "install.step.downloading": "Загрузка сервера", + "install.step.unpacking": "Распаковка", + "install.step.database": "Подготовка базы данных", + "install.step.finishing": "Завершение", + "install.doneTitle": "Ваш сервер готов", + "install.doneText": "Всё установлено. Запустите сервер на следующем экране.", + "install.open": "ОТКРЫТЬ МОЙ СЕРВЕР", }; export default ru; diff --git a/src/screens/ImportServer.tsx b/src/screens/ImportServer.tsx index a716852..5745c23 100644 --- a/src/screens/ImportServer.tsx +++ b/src/screens/ImportServer.tsx @@ -4,24 +4,13 @@ import { AlertTriangle, Check, Minus } from "lucide-react"; import { api, asUiError, type Classification, type ScanReport, type ServerSummary, type UiError } from "@/lib/api"; import { Button } from "@/components/ui/button"; import { Card } from "@/components/ui/card"; +import { useHuman, useT, type Key } from "@/i18n"; -const HEADLINE: Record = { - healthy: { title: "Existing server detected", tone: "text-ok", text: "Everything needed to run this server was found." }, - partial: { - title: "Server partly found", - tone: "text-warn", - text: "Some parts are missing. You can still add it; nothing will be fixed automatically.", - }, - "unknown-custom": { - title: "Custom server detected", - tone: "text-warn", - text: "This build is not recognised. Some update and install features will be disabled.", - }, - incompatible: { - title: "This is not a server folder", - tone: "text-bad", - text: "Choose the folder that contains Core, Data and mysql (or your worldserver.exe).", - }, +const HEADLINE: Record = { + healthy: { title: "import.healthy.title", tone: "text-ok", text: "import.healthy.text" }, + partial: { title: "import.partial.title", tone: "text-warn", text: "import.partial.text" }, + "unknown-custom": { title: "import.custom.title", tone: "text-warn", text: "import.custom.text" }, + incompatible: { title: "import.incompatible.title", tone: "text-bad", text: "import.incompatible.text" }, }; export function ImportServer(props: { @@ -29,13 +18,15 @@ export function ImportServer(props: { onCancel: () => void; onAdded: (s: ServerSummary) => void | Promise; }) { + const t = useT(); + const human = useHuman(); const [report, setReport] = useState(null); const [error, setError] = useState(null); const [busy, setBusy] = useState(false); async function choose() { setError(null); - const picked = await open({ directory: true, multiple: false, title: "Choose your server folder" }); + const picked = await open({ directory: true, multiple: false, title: t("import.dialogTitle") }); if (typeof picked !== "string") return; setBusy(true); setReport(null); @@ -64,29 +55,29 @@ export function ImportServer(props: { return (
-

Add an existing server

-

Pick the folder your server runs from. It will only be read.

+

{t("import.title")}

+

{t("import.subtitle")}

{props.canCancel && ( )}
- {busy && !report &&

Looking at your server…

} + {busy && !report &&

{t("import.looking")}

} {error && ( -

{error.human.title}

-

{error.human.message}

+

{human(error.human).title}

+

{human(error.human).message}

- Show technical details + {t("import.techDetails")}
{error.technical}
@@ -101,8 +92,8 @@ export function ImportServer(props: { )}
-

{head.title}

-

{head.text}

+

{t(head.title)}

+

{t(head.text)}

{report.path}

@@ -115,11 +106,11 @@ export function ImportServer(props: { {it.detail && {it.detail}} {it.status === "found" ? ( - Detected + {t("import.detected")} ) : ( - {it.key === "companions" ? "Not installed" : "Not found"} + {it.key === "companions" ? t("import.notInstalled") : t("import.notFound")} )} @@ -134,13 +125,13 @@ export function ImportServer(props: { ))}
-

No files will be changed during import.

+

{t("import.noChanges")}

diff --git a/src/screens/InstallServer.tsx b/src/screens/InstallServer.tsx index 44efdf9..ce11cd9 100644 --- a/src/screens/InstallServer.tsx +++ b/src/screens/InstallServer.tsx @@ -5,10 +5,23 @@ import { Check, ChevronDown, ChevronRight, Loader2 } from "lucide-react"; import { api, asUiError, type InstallStep, type Preflight, type ServerSummary, type UiError } from "@/lib/api"; import { Button } from "@/components/ui/button"; import { Card } from "@/components/ui/card"; +import { useHuman, useT, type Key } from "@/i18n"; + +// The backend reports progress with these English step names; map the known ones to translations. +const STEP_KEYS: Record = { + "Preparing your server": "install.progressTitle", + "Checking your computer": "install.step.checking", + "Downloading server": "install.step.downloading", + Unpacking: "install.step.unpacking", + "Preparing database": "install.step.database", + Finishing: "install.step.finishing", +}; type Phase = "choose" | "installing" | "done"; export function InstallServer(props: { canCancel: boolean; onCancel: () => void; onDone: (s: ServerSummary) => void | Promise }) { + const t = useT(); + const human = useHuman(); const [dest, setDest] = useState("C:\\Games\\CoA Server"); const [pre, setPre] = useState(null); const [phase, setPhase] = useState("choose"); @@ -32,12 +45,12 @@ export function InstallServer(props: { canCancel: boolean; onCancel: () => void; }, []); async function browse() { - const picked = await open({ directory: true, multiple: false, title: "Choose where to install your server" }); + const picked = await open({ directory: true, multiple: false, title: t("install.dialogTitle") }); if (typeof picked === "string") setDest(picked.replace(/[\\/]+$/, "") + (picked.toLowerCase().includes("coa") ? "" : "\\CoA Server")); } async function browsePackage() { - const picked = await open({ directory: true, multiple: false, title: "Choose a server package folder" }); + const picked = await open({ directory: true, multiple: false, title: t("install.pkgDialogTitle") }); if (typeof picked === "string") setPkg(picked); } @@ -58,12 +71,12 @@ export function InstallServer(props: { canCancel: boolean; onCancel: () => void; if (phase === "installing") { return (
-

Preparing your server

-

This can take a few minutes. You can leave this window open.

+

{t("install.progressTitle")}

+

{t("install.progressText")}

- {step.step} + {STEP_KEYS[step.step] ? t(STEP_KEYS[step.step]) : step.step} {step.percent}%
@@ -74,7 +87,7 @@ export function InstallServer(props: { canCancel: boolean; onCancel: () => void;
{step.step === "Downloading server" && ( )}
@@ -87,10 +100,10 @@ export function InstallServer(props: { canCancel: boolean; onCancel: () => void;
-

Your server is ready

-

Everything is installed. Start it from the next screen.

+

{t("install.doneTitle")}

+

{t("install.doneText")}

); @@ -99,12 +112,12 @@ export function InstallServer(props: { canCancel: boolean; onCancel: () => void; return (
-

Install a new server

-

Choose a folder, or keep the suggested one. Everything else is set up for you.

+

{t("install.title")}

+

{t("install.subtitle")}

- +
void; onChange={(e) => setDest(e.target.value)} className="selectable flex-1 rounded-md border border-line bg-card px-3 py-2.5 text-[15px] outline-none focus:border-gold" /> - +
@@ -123,15 +136,15 @@ export function InstallServer(props: { canCancel: boolean; onCancel: () => void; ))} )} - {pre?.ok &&

This folder is ready. {Math.round(pre.free_bytes / (1 << 30))} GB free.

} + {pre?.ok &&

{t("install.ready", { gb: Math.round(pre.free_bytes / (1 << 30)) })}

} {error && ( -

{error.human.code === "unknown" ? "The installation could not finish" : error.human.title}

-

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

-

Nothing was installed. You can try again; downloaded files are kept.

+

{error.human.code === "unknown" ? t("install.failedTitle") : human(error.human).title}

+

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

+

{t("install.nothingInstalled")}

{showDetails &&
{error.technical}
}
@@ -140,14 +153,14 @@ export function InstallServer(props: { canCancel: boolean; onCancel: () => void;
{showAdvanced && (
- +
- setPkg(e.target.value)} placeholder="(leave empty to download)" className="selectable flex-1 rounded-md border border-line bg-card px-3 py-2 text-sm outline-none focus:border-gold" /> - + setPkg(e.target.value)} placeholder={t("install.localPkgHint")} className="selectable flex-1 rounded-md border border-line bg-card px-3 py-2 text-sm outline-none focus:border-gold" /> +
)} @@ -155,11 +168,11 @@ export function InstallServer(props: { canCancel: boolean; onCancel: () => void;
{props.canCancel && ( )}