From 303990641140ffffb49f73d9f0000c849e2a9744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Wed, 30 Sep 2026 11:55:08 +0500 Subject: [PATCH] UI: translate Play with Friends page Co-Authored-By: Claude Sonnet 5.5 --- src/i18n/locales/de.ts | 46 ++++++++++++++++++++++ src/i18n/locales/en.ts | 46 ++++++++++++++++++++++ src/i18n/locales/es.ts | 46 ++++++++++++++++++++++ src/i18n/locales/fr.ts | 46 ++++++++++++++++++++++ src/i18n/locales/ru.ts | 46 ++++++++++++++++++++++ src/screens/FriendsPage.tsx | 76 +++++++++++++++++++------------------ 6 files changed, 270 insertions(+), 36 deletions(-) diff --git a/src/i18n/locales/de.ts b/src/i18n/locales/de.ts index 1d933f1..a652b99 100644 --- a/src/i18n/locales/de.ts +++ b/src/i18n/locales/de.ts @@ -272,6 +272,52 @@ const de: Partial> = { "bk.problem": "Problem gefunden: {details}", "bk.delete": "Löschen", "bk.confirmDelete": "Diese Sicherung löschen? Nur diese Sicherung wird entfernt; dein Server bleibt unberührt.", + + // Friends + "fr.title": "Mit Freunden spielen", + "fr.looking": "Verbindung wird geprüft …", + "fr.ok": "OK", + "fr.notYet": "noch nicht", + "fr.mode.lan.title": "Lokales Netzwerk", + "fr.mode.lan.text": "Freunde im selben Heimnetzwerk oder WLAN.", + "fr.mode.direct.title": "Über das Internet", + "fr.mode.direct.text": "Freunde von überall, über deine Internetverbindung. Dein Router muss das erlauben.", + "fr.mode.private.title": "Privates Netzwerk", + "fr.mode.private.text": "Freunde von überall, ohne Router-Einrichtung. Nutzt die kostenlose Tailscale-App.", + "fr.restartToApply": "Starte den Server neu, um dies anzuwenden.", + "fr.ready": "Bereit für Freunde.", + "fr.exposedTitle": "Etwas Privates ist aus deinem Netzwerk erreichbar", + "fr.exposedText": "{what} akzeptieren Verbindungen von anderen Computern. Starte den Server über dieses Programm neu, um sie zu schließen.", + "fr.what.database": "Datenbank", + "fr.what.console": "Serverkonsole", + "fr.and": " und ", + "fr.status": "Status", + "fr.st.running": "Server läuft", + "fr.st.open": "Anmelde- und Spielserver sind für andere Computer offen", + "fr.st.firewall": "Die Windows-Firewall lässt die Spielports zu", + "fr.st.private": "Datenbank und Serverkonsole sind nur auf diesem Computer erreichbar", + "fr.inUse": "In Gebrauch", + "fr.yourLan": "Deine Adresse in diesem Netzwerk:", + "fr.unknown": "unbekannt", + "fr.checkConn": "Meine Verbindung prüfen", + "fr.cgnat": "Dein Internetanbieter erlaubt kein direktes Hosting. Nutze stattdessen das private Netzwerk.", + "fr.publicAddr": "Deine öffentliche Adresse:", + "fr.noRouter": " · dein Router kann nicht automatisch eingerichtet werden; leite die beiden Spielports manuell weiter", + "fr.noInternet": "Das Internet war nicht erreichbar, um deine Adresse zu ermitteln.", + "fr.tsMissing": "Tailscale ist nicht installiert. Installiere die kostenlose App von tailscale.com/download, melde dich an und komm zurück.", + "fr.tsOff": "Tailscale ist installiert, aber nicht verbunden. Melde dich zuerst an.", + "fr.privateAddr": "Deine private Adresse:", + "fr.checkFirst": "Prüfe zuerst deine Verbindung", + "fr.reapply": "Erneut anwenden", + "fr.enable": "Aktivieren", + "fr.onlyLocal": "Jetzt kann sich nur dieser Computer verbinden.", + "fr.stopSharing": "Freigabe beenden (nur dieser Computer)", + "fr.giveTitle": "Gib das deinem Freund", + "fr.giveText": "Er trägt diese Zeile in die Datei realmlist.wtf seines Spiels ein. Passwörter und Einstellungen werden nie weitergegeben.", + "fr.copied": "Kopiert", + "fr.copy": "Verbindungsdaten kopieren", + "fr.pkg": "Freundepaket erstellen (zip)", + "fr.pkgSaved": "Gespeichert: {path}", }; export default de; diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index 7c1dce1..49b4ea6 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -272,6 +272,52 @@ const en = { "bk.problem": "Problem found: {details}", "bk.delete": "Delete", "bk.confirmDelete": "Delete this backup? Only this backup is removed; your server is not affected.", + + // Friends + "fr.title": "Play with Friends", + "fr.looking": "Looking at your connection…", + "fr.ok": "OK", + "fr.notYet": "not yet", + "fr.mode.lan.title": "Local network", + "fr.mode.lan.text": "Friends on the same home network or Wi-Fi.", + "fr.mode.direct.title": "Over the internet", + "fr.mode.direct.text": "Friends anywhere, through your internet connection. Needs your router to allow it.", + "fr.mode.private.title": "Private network", + "fr.mode.private.text": "Friends anywhere, no router setup. Uses the free Tailscale app.", + "fr.restartToApply": "Restart the server to apply this.", + "fr.ready": "Ready for friends.", + "fr.exposedTitle": "Something private is reachable from your network", + "fr.exposedText": "{what} accept connections from other computers. Restart the server from this program to close them.", + "fr.what.database": "database", + "fr.what.console": "server console", + "fr.and": " and ", + "fr.status": "Status", + "fr.st.running": "Server is running", + "fr.st.open": "Login and game servers are open to other computers", + "fr.st.firewall": "Windows Firewall allows the game ports", + "fr.st.private": "Database and server console are private to this computer", + "fr.inUse": "In use", + "fr.yourLan": "Your address on this network:", + "fr.unknown": "unknown", + "fr.checkConn": "Check my connection", + "fr.cgnat": "Your internet provider does not allow direct hosting. Use the private network instead.", + "fr.publicAddr": "Your public address:", + "fr.noRouter": " · your router cannot be set up automatically; forward the two game ports by hand", + "fr.noInternet": "Could not reach the internet to find your address.", + "fr.tsMissing": "Tailscale is not installed. Install the free app from tailscale.com/download, sign in, then come back.", + "fr.tsOff": "Tailscale is installed but not connected. Sign in to it first.", + "fr.privateAddr": "Your private address:", + "fr.checkFirst": "Check your connection first", + "fr.reapply": "Re-apply", + "fr.enable": "Enable", + "fr.onlyLocal": "Only this computer can connect now.", + "fr.stopSharing": "Stop sharing (this computer only)", + "fr.giveTitle": "Give this to your friend", + "fr.giveText": "They put this line in their game's realmlist.wtf file. Passwords and settings are never shared.", + "fr.copied": "Copied", + "fr.copy": "Copy connection info", + "fr.pkg": "Create friend package (zip)", + "fr.pkgSaved": "Saved: {path}", } as const; export default en; diff --git a/src/i18n/locales/es.ts b/src/i18n/locales/es.ts index 8371aaa..015e05d 100644 --- a/src/i18n/locales/es.ts +++ b/src/i18n/locales/es.ts @@ -272,6 +272,52 @@ const es: Partial> = { "bk.problem": "Problema detectado: {details}", "bk.delete": "Eliminar", "bk.confirmDelete": "¿Eliminar esta copia? Solo se elimina esta copia; tu servidor no se ve afectado.", + + // Friends + "fr.title": "Jugar con amigos", + "fr.looking": "Examinando tu conexión…", + "fr.ok": "Correcto", + "fr.notYet": "aún no", + "fr.mode.lan.title": "Red local", + "fr.mode.lan.text": "Amigos en la misma red doméstica o Wi-Fi.", + "fr.mode.direct.title": "A través de internet", + "fr.mode.direct.text": "Amigos desde cualquier lugar, a través de tu conexión a internet. Tu router debe permitirlo.", + "fr.mode.private.title": "Red privada", + "fr.mode.private.text": "Amigos desde cualquier lugar, sin configurar el router. Usa la aplicación gratuita Tailscale.", + "fr.restartToApply": "Reinicia el servidor para aplicar esto.", + "fr.ready": "Listo para tus amigos.", + "fr.exposedTitle": "Algo privado es accesible desde tu red", + "fr.exposedText": "{what} aceptan conexiones desde otros equipos. Reinicia el servidor desde este programa para cerrarlos.", + "fr.what.database": "base de datos", + "fr.what.console": "consola del servidor", + "fr.and": " y ", + "fr.status": "Estado", + "fr.st.running": "El servidor está en marcha", + "fr.st.open": "Los servidores de acceso y de juego están abiertos a otros equipos", + "fr.st.firewall": "El Firewall de Windows permite los puertos del juego", + "fr.st.private": "La base de datos y la consola del servidor son privadas de este equipo", + "fr.inUse": "En uso", + "fr.yourLan": "Tu dirección en esta red:", + "fr.unknown": "desconocida", + "fr.checkConn": "Comprobar mi conexión", + "fr.cgnat": "Tu proveedor de internet no permite el alojamiento directo. Usa la red privada.", + "fr.publicAddr": "Tu dirección pública:", + "fr.noRouter": " · tu router no se puede configurar automáticamente; redirige los dos puertos del juego a mano", + "fr.noInternet": "No se pudo acceder a internet para averiguar tu dirección.", + "fr.tsMissing": "Tailscale no está instalado. Instala la aplicación gratuita desde tailscale.com/download, inicia sesión y vuelve.", + "fr.tsOff": "Tailscale está instalado pero no conectado. Inicia sesión primero.", + "fr.privateAddr": "Tu dirección privada:", + "fr.checkFirst": "Comprueba primero tu conexión", + "fr.reapply": "Volver a aplicar", + "fr.enable": "Activar", + "fr.onlyLocal": "Ahora solo este equipo puede conectarse.", + "fr.stopSharing": "Dejar de compartir (solo este equipo)", + "fr.giveTitle": "Dale esto a tu amigo", + "fr.giveText": "Debe poner esta línea en el archivo realmlist.wtf de su juego. Las contraseñas y ajustes nunca se comparten.", + "fr.copied": "Copiado", + "fr.copy": "Copiar datos de conexión", + "fr.pkg": "Crear paquete para amigo (zip)", + "fr.pkgSaved": "Guardado: {path}", }; export default es; diff --git a/src/i18n/locales/fr.ts b/src/i18n/locales/fr.ts index 459c3a3..c4f6691 100644 --- a/src/i18n/locales/fr.ts +++ b/src/i18n/locales/fr.ts @@ -272,6 +272,52 @@ const fr: Partial> = { "bk.problem": "Problème détecté : {details}", "bk.delete": "Supprimer", "bk.confirmDelete": "Supprimer cette sauvegarde ? Seule cette sauvegarde est supprimée ; votre serveur n’est pas affecté.", + + // Friends + "fr.title": "Jouer avec des amis", + "fr.looking": "Analyse de votre connexion…", + "fr.ok": "OK", + "fr.notYet": "pas encore", + "fr.mode.lan.title": "Réseau local", + "fr.mode.lan.text": "Amis sur le même réseau domestique ou Wi-Fi.", + "fr.mode.direct.title": "Via Internet", + "fr.mode.direct.text": "Amis où qu’ils soient, via votre connexion internet. Votre routeur doit l’autoriser.", + "fr.mode.private.title": "Réseau privé", + "fr.mode.private.text": "Amis où qu’ils soient, sans configurer le routeur. Utilise l’application gratuite Tailscale.", + "fr.restartToApply": "Redémarrez le serveur pour appliquer cela.", + "fr.ready": "Prêt pour vos amis.", + "fr.exposedTitle": "Un élément privé est accessible depuis votre réseau", + "fr.exposedText": "{what} acceptent des connexions depuis d’autres ordinateurs. Redémarrez le serveur depuis ce programme pour les fermer.", + "fr.what.database": "base de données", + "fr.what.console": "console du serveur", + "fr.and": " et ", + "fr.status": "État", + "fr.st.running": "Le serveur fonctionne", + "fr.st.open": "Les serveurs de connexion et de jeu sont ouverts aux autres ordinateurs", + "fr.st.firewall": "Le pare-feu Windows autorise les ports du jeu", + "fr.st.private": "La base de données et la console du serveur restent privées à cet ordinateur", + "fr.inUse": "Utilisé", + "fr.yourLan": "Votre adresse sur ce réseau :", + "fr.unknown": "inconnue", + "fr.checkConn": "Vérifier ma connexion", + "fr.cgnat": "Votre fournisseur d’accès ne permet pas l’hébergement direct. Utilisez plutôt le réseau privé.", + "fr.publicAddr": "Votre adresse publique :", + "fr.noRouter": " · votre routeur ne peut pas être configuré automatiquement ; redirigez les deux ports du jeu à la main", + "fr.noInternet": "Impossible d’accéder à internet pour trouver votre adresse.", + "fr.tsMissing": "Tailscale n’est pas installé. Installez l’application gratuite depuis tailscale.com/download, connectez-vous, puis revenez.", + "fr.tsOff": "Tailscale est installé mais non connecté. Connectez-vous d’abord.", + "fr.privateAddr": "Votre adresse privée :", + "fr.checkFirst": "Vérifiez d’abord votre connexion", + "fr.reapply": "Réappliquer", + "fr.enable": "Activer", + "fr.onlyLocal": "Seul cet ordinateur peut se connecter maintenant.", + "fr.stopSharing": "Arrêter le partage (cet ordinateur uniquement)", + "fr.giveTitle": "Donnez ceci à votre ami", + "fr.giveText": "Il place cette ligne dans le fichier realmlist.wtf de son jeu. Les mots de passe et paramètres ne sont jamais partagés.", + "fr.copied": "Copié", + "fr.copy": "Copier les informations de connexion", + "fr.pkg": "Créer le paquet pour ami (zip)", + "fr.pkgSaved": "Enregistré : {path}", }; export default fr; diff --git a/src/i18n/locales/ru.ts b/src/i18n/locales/ru.ts index 3410582..31ce5b5 100644 --- a/src/i18n/locales/ru.ts +++ b/src/i18n/locales/ru.ts @@ -272,6 +272,52 @@ const ru: Partial> = { "bk.problem": "Обнаружена проблема: {details}", "bk.delete": "Удалить", "bk.confirmDelete": "Удалить эту копию? Удаляется только она; ваш сервер не затрагивается.", + + // Friends + "fr.title": "Игра с друзьями", + "fr.looking": "Проверяю ваше подключение…", + "fr.ok": "Готово", + "fr.notYet": "ещё нет", + "fr.mode.lan.title": "Локальная сеть", + "fr.mode.lan.text": "Друзья в той же домашней сети или Wi-Fi.", + "fr.mode.direct.title": "Через интернет", + "fr.mode.direct.text": "Друзья из любого места через ваше интернет-соединение. Нужно, чтобы роутер это разрешал.", + "fr.mode.private.title": "Частная сеть", + "fr.mode.private.text": "Друзья из любого места, без настройки роутера. Используется бесплатное приложение Tailscale.", + "fr.restartToApply": "Перезапустите сервер, чтобы применить это.", + "fr.ready": "Готово для друзей.", + "fr.exposedTitle": "Нечто приватное доступно из вашей сети", + "fr.exposedText": "Принимают подключения с других компьютеров: {what}. Перезапустите сервер из этой программы, чтобы закрыть доступ.", + "fr.what.database": "база данных", + "fr.what.console": "консоль сервера", + "fr.and": " и ", + "fr.status": "Состояние", + "fr.st.running": "Сервер запущен", + "fr.st.open": "Серверы входа и игры открыты для других компьютеров", + "fr.st.firewall": "Брандмауэр Windows пропускает игровые порты", + "fr.st.private": "База данных и консоль сервера доступны только на этом компьютере", + "fr.inUse": "Используется", + "fr.yourLan": "Ваш адрес в этой сети:", + "fr.unknown": "неизвестен", + "fr.checkConn": "Проверить моё подключение", + "fr.cgnat": "Ваш интернет-провайдер не разрешает прямое размещение сервера. Используйте частную сеть.", + "fr.publicAddr": "Ваш публичный адрес:", + "fr.noRouter": " · роутер нельзя настроить автоматически; пробросьте два игровых порта вручную", + "fr.noInternet": "Не удалось выйти в интернет, чтобы определить ваш адрес.", + "fr.tsMissing": "Tailscale не установлен. Установите бесплатное приложение с tailscale.com/download, войдите в него и вернитесь сюда.", + "fr.tsOff": "Tailscale установлен, но не подключён. Сначала войдите в него.", + "fr.privateAddr": "Ваш частный адрес:", + "fr.checkFirst": "Сначала проверьте подключение", + "fr.reapply": "Применить заново", + "fr.enable": "Включить", + "fr.onlyLocal": "Теперь подключиться может только этот компьютер.", + "fr.stopSharing": "Прекратить доступ (только этот компьютер)", + "fr.giveTitle": "Передайте это другу", + "fr.giveText": "Друг вписывает эту строку в файл realmlist.wtf своей игры. Пароли и настройки никогда не передаются.", + "fr.copied": "Скопировано", + "fr.copy": "Скопировать данные подключения", + "fr.pkg": "Создать пакет для друга (zip)", + "fr.pkgSaved": "Сохранено: {path}", }; export default ru; diff --git a/src/screens/FriendsPage.tsx b/src/screens/FriendsPage.tsx index 4b491c7..3b2cc0e 100644 --- a/src/screens/FriendsPage.tsx +++ b/src/screens/FriendsPage.tsx @@ -3,24 +3,28 @@ import { Check, Loader2, Minus } from "lucide-react"; import { api, asUiError, type FriendsMode, type FriendsStatus, type InternetCheck, type UiError } from "@/lib/api"; import { Button } from "@/components/ui/button"; import { Card } from "@/components/ui/card"; +import { useHuman, useT, type Key } from "@/i18n"; function Line({ ok, children, warn }: { ok: boolean; warn?: boolean; children: React.ReactNode }) { + const t = useT(); return (
  • {ok ? : } {children} - {ok ? "OK" : "not yet"} + {ok ? t("fr.ok") : t("fr.notYet")}
  • ); } -const MODES: { id: FriendsMode; title: string; text: string }[] = [ - { id: "lan", title: "Local network", text: "Friends on the same home network or Wi-Fi." }, - { id: "direct", title: "Over the internet", text: "Friends anywhere, through your internet connection. Needs your router to allow it." }, - { id: "private", title: "Private network", text: "Friends anywhere, no router setup. Uses the free Tailscale app." }, +const MODES: { id: FriendsMode; title: Key; text: Key }[] = [ + { id: "lan", title: "fr.mode.lan.title", text: "fr.mode.lan.text" }, + { id: "direct", title: "fr.mode.direct.title", text: "fr.mode.direct.text" }, + { id: "private", title: "fr.mode.private.title", text: "fr.mode.private.text" }, ]; export function FriendsPage({ serverId }: { serverId: string }) { + const t = useT(); + const human = useHuman(); const [st, setSt] = useState(null); const [net, setNet] = useState(null); const [busy, setBusy] = useState(null); @@ -56,10 +60,10 @@ export function FriendsPage({ serverId }: { serverId: string }) { const enable = (mode: FriendsMode) => run(`enable-${mode}`, async () => { const r = await api.friendsEnable(serverId, mode, net?.public_ip ?? undefined, mode === "direct" && !!net?.router_found); - return [r.restart_required ? "Restart the server to apply this." : null, r.note].filter(Boolean).join(" ") || "Ready for friends."; + return [r.restart_required ? t("fr.restartToApply") : null, r.note].filter(Boolean).join(" ") || t("fr.ready"); }); - if (!st) return

    {error ? error.human.message : "Looking at your connection…"}

    ; + if (!st) return

    {error ? human(error.human).message : t("fr.looking")}

    ; const cur = st.settings; const exposed = st.exposure.filter((e) => (e.what === "database" || e.what === "server console") && e.reachable_from_network); @@ -67,24 +71,24 @@ export function FriendsPage({ serverId }: { serverId: string }) { return (
    -

    Play with Friends

    -

    How can my friend join?

    +

    {t("fr.title")}

    +

    {t("q.friends")}

    {exposed.length > 0 && ( -

    Something private is reachable from your network

    -

    {exposed.map((e) => e.what).join(" and ")} accept connections from other computers. Restart the server from this program to close them.

    +

    {t("fr.exposedTitle")}

    +

    {t("fr.exposedText", { what: exposed.map((e) => t(e.what === "database" ? "fr.what.database" : "fr.what.console")).join(t("fr.and")) })}

    )} -

    Status

    +

    {t("fr.status")}

      - Server is running - Login and game servers are open to other computers - Windows Firewall allows the game ports + {t("fr.st.running")} + {t("fr.st.open")} + {t("fr.st.firewall")} e.what === "database" || e.what === "server console").every((e) => !e.reachable_from_network)}> - Database and server console are private to this computer + {t("fr.st.private")}
    @@ -95,35 +99,35 @@ export function FriendsPage({ serverId }: { serverId: string }) {

    - {m.title} {cur.mode === m.id && In use} + {t(m.title)} {cur.mode === m.id && {t("fr.inUse")}}

    -

    {m.text}

    +

    {t(m.text)}

    - {m.id === "lan" &&

    Your address on this network: {st.lan_ip ?? "unknown"}

    } + {m.id === "lan" &&

    {t("fr.yourLan")} {st.lan_ip ?? t("fr.unknown")}

    } {m.id === "direct" && (
    {net && net.reachability === "cgnat" && (

    - Your internet provider does not allow direct hosting. Use the private network instead. + {t("fr.cgnat")}

    )} {net?.public_ip && net.reachability !== "cgnat" && ( -

    Your public address: {net.public_ip}{!net.router_found && · your router cannot be set up automatically; forward the two game ports by hand}

    +

    {t("fr.publicAddr")} {net.public_ip}{!net.router_found && {t("fr.noRouter")}}

    )} - {net && !net.public_ip &&

    Could not reach the internet to find your address.

    } + {net && !net.public_ip &&

    {t("fr.noInternet")}

    }
    )} {m.id === "private" && (

    - {!st.tailscale.installed && Tailscale is not installed. Install the free app from tailscale.com/download, sign in, then come back.} - {st.tailscale.installed && !st.tailscale.connected && Tailscale is installed but not connected. Sign in to it first.} - {st.tailscale.connected && <>Your private address: {st.tailscale.ip}} + {!st.tailscale.installed && {t("fr.tsMissing")}} + {st.tailscale.installed && !st.tailscale.connected && {t("fr.tsOff")}} + {st.tailscale.connected && <>{t("fr.privateAddr")} {st.tailscale.ip}}

    )}
    @@ -132,39 +136,39 @@ export function FriendsPage({ serverId }: { serverId: string }) { variant={m.id === "private" && net?.reachability === "cgnat" ? "primary" : "secondary"} disabled={!!busy || (m.id === "direct" && !net?.public_ip) || (m.id === "private" && !st.tailscale.connected)} onClick={() => void enable(m.id)} - title={m.id === "direct" && !net?.public_ip ? "Check your connection first" : undefined} + title={m.id === "direct" && !net?.public_ip ? t("fr.checkFirst") : undefined} > {busy === `enable-${m.id}` && } - {cur.mode === m.id ? "Re-apply" : "Enable"} + {cur.mode === m.id ? t("fr.reapply") : t("fr.enable")}
    ))} {cur.mode !== "local" && ( - )}
    {connection && ( -

    Give this to your friend

    -

    They put this line in their game's realmlist.wtf file. Passwords and settings are never shared.

    +

    {t("fr.giveTitle")}

    +

    {t("fr.giveText")}

    {connection}
    -
    )} {note &&

    {note}

    } - {error &&

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

    } + {error &&

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

    } ); }