"use strict"; // Player-facing launcher texts (start-failure box, update dialogs, macOS menu) in the client's interface language: the profile's // settings.json (options.interfaceLanguage, what the in-game language picker saves), else the OS locale, else French. const fs = require("fs"); const path = require("path"); const { app } = require("electron"); const TEXTS = { fr: { startFailed: "Khaos n'a pas pu se connecter au serveur.", startFailedDetail: "{0}\n\nRelancez Khaos. Si le problème continue, envoyez le dossier de journaux à l'équipe Khaos :\n{1}", connectorStopped: "Le service de connexion s'est arrêté trois fois en cinq minutes.", updateReady: "La mise à jour {0} de Khaos est prête.", updateReadyDetail: "Khaos va redémarrer pour l'installer (environ une minute). En combat ou en donjon, choisissez « Plus tard » : elle s'installera quand vous fermerez Khaos.", restartNow: "Redémarrer maintenant", updateInstalling: "Khaos termine l'installation de sa mise à jour.", updateInstallingDetail: "Patientez une minute, puis relancez Khaos.", later: "Plus tard", // macOS: a build that is not Developer ID-signed cannot replace itself (Squirrel.Mac checks the signature), so the // update is downloaded from the website (updater.cjs). updateAvailableManual: "La version {0} de Khaos est disponible.", updateAvailableManualDetail: "Téléchargez-la sur le site, puis remplacez Khaos dans le dossier Applications. Vos réglages, votre connexion et les données de jeu sont conservés.", // Linux: a Khaos that was not started as its AppImage (extracted, repackaged) cannot replace itself. updateAvailableManualDetailLinux: "Téléchargez la nouvelle AppImage sur le site et lancez-la à la place de l'ancienne. Vos réglages, votre connexion et les données de jeu sont conservés.", download: "Télécharger", // macOS application menu (main.cjs) gpuUnavailable: "Khaos ne peut pas afficher le jeu sur ce PC (WebGL2 indisponible).", gpuUnavailableDetail: "Khaos a essayé tous ses modes graphiques (normal, compatibilité, logiciel) sans succès.\n\nÀ essayer :\n• mettre à jour le pilote de la carte graphique (site d'Intel, d'AMD ou de NVIDIA) ;\n• sur un PC avec deux cartes graphiques : Paramètres Windows > Système > Écran > Graphiques, ajouter Khaos et choisir « Hautes performances » ;\n• puis cliquer sur « Réessayer ». Si rien ne change, envoyez ce message au support.\n\n{0}", gpuRetry: "Réessayer", gpuQuit: "Quitter", menuAbout: "À propos de Khaos", menuHide: "Masquer Khaos", menuHideOthers: "Masquer les autres", menuShowAll: "Tout afficher", menuQuit: "Quitter Khaos", menuEdit: "Édition", menuUndo: "Annuler", menuRedo: "Rétablir", menuCut: "Couper", menuCopy: "Copier", menuPaste: "Coller", menuSelectAll: "Tout sélectionner", menuWindow: "Fenêtre", menuMinimize: "Réduire", menuZoom: "Agrandir", menuFullScreen: "Plein écran", }, en: { startFailed: "Khaos could not connect to the server.", startFailedDetail: "{0}\n\nStart Khaos again. If it keeps happening, send the log folder to the Khaos team:\n{1}", connectorStopped: "The connection service stopped three times in five minutes.", updateReady: "Khaos update {0} is ready.", updateReadyDetail: "Khaos will restart to install it (about a minute). In a fight or a dungeon, choose \"Later\": it will install when you close Khaos.", restartNow: "Restart now", updateInstalling: "Khaos is finishing installing its update.", updateInstallingDetail: "Wait a minute, then start Khaos again.", later: "Later", updateAvailableManual: "Khaos {0} is available.", updateAvailableManualDetail: "Download it from the website, then replace Khaos in your Applications folder. Your settings, login and game data are kept.", updateAvailableManualDetailLinux: "Download the new AppImage from the website and start it instead of the old one. Your settings, login and game data are kept.", download: "Download", gpuUnavailable: "Khaos cannot display the game on this PC (WebGL2 unavailable).", gpuUnavailableDetail: "Khaos tried all its graphics modes (normal, compatibility, software) without success.\n\nThings to try:\n• update the graphics card driver (Intel, AMD or NVIDIA website);\n• on a PC with two graphics cards: Windows Settings > System > Display > Graphics, add Khaos and choose \"High performance\";\n• then click \"Retry\". If nothing changes, send this message to support.\n\n{0}", gpuRetry: "Retry", gpuQuit: "Quit", menuAbout: "About Khaos", menuHide: "Hide Khaos", menuHideOthers: "Hide Others", menuShowAll: "Show All", menuQuit: "Quit Khaos", menuEdit: "Edit", menuUndo: "Undo", menuRedo: "Redo", menuCut: "Cut", menuCopy: "Copy", menuPaste: "Paste", menuSelectAll: "Select All", menuWindow: "Window", menuMinimize: "Minimize", menuZoom: "Zoom", menuFullScreen: "Full Screen", }, es: { startFailed: "Khaos no ha podido conectarse al servidor.", startFailedDetail: "{0}\n\nVuelve a abrir Khaos. Si el problema continúa, envía la carpeta de registros al equipo de Khaos:\n{1}", connectorStopped: "El servicio de conexión se ha detenido tres veces en cinco minutos.", updateReady: "La actualización {0} de Khaos está lista.", updateReadyDetail: "Khaos se reiniciará para instalarla (alrededor de un minuto). En un combate o una mazmorra, elige «Más tarde»: se instalará cuando cierres Khaos.", restartNow: "Reiniciar ahora", updateInstalling: "Khaos está terminando de instalar su actualización.", updateInstallingDetail: "Espera un minuto y vuelve a abrir Khaos.", later: "Más tarde", updateAvailableManual: "La versión {0} de Khaos está disponible.", updateAvailableManualDetail: "Descárgala desde la web y sustituye Khaos en la carpeta Aplicaciones. Se conservan tus ajustes, tu sesión y los datos del juego.", updateAvailableManualDetailLinux: "Descarga la nueva AppImage desde la web y ábrela en lugar de la antigua. Se conservan tus ajustes, tu sesión y los datos del juego.", download: "Descargar", gpuUnavailable: "Khaos no puede mostrar el juego en este PC (WebGL2 no disponible).", gpuUnavailableDetail: "Khaos probó todos sus modos gráficos (normal, compatibilidad, software) sin éxito.\n\nPuedes probar:\n• actualizar el controlador de la tarjeta gráfica (web de Intel, AMD o NVIDIA);\n• en un PC con dos tarjetas gráficas: Configuración de Windows > Sistema > Pantalla > Gráficos, añadir Khaos y elegir «Alto rendimiento»;\n• después, pulsar «Reintentar». Si nada cambia, envía este mensaje al soporte.\n\n{0}", gpuRetry: "Reintentar", gpuQuit: "Salir", menuAbout: "Acerca de Khaos", menuHide: "Ocultar Khaos", menuHideOthers: "Ocultar otros", menuShowAll: "Mostrar todo", menuQuit: "Salir de Khaos", menuEdit: "Edición", menuUndo: "Deshacer", menuRedo: "Rehacer", menuCut: "Cortar", menuCopy: "Copiar", menuPaste: "Pegar", menuSelectAll: "Seleccionar todo", menuWindow: "Ventana", menuMinimize: "Minimizar", menuZoom: "Zoom", menuFullScreen: "Pantalla completa", }, }; function language(userData) { try { const saved = JSON.parse(fs.readFileSync(path.join(userData, "settings.json"), "utf8")); const lang = saved?.options?.interfaceLanguage ?? saved?.interfaceLanguage; if (TEXTS[lang]) return lang; } catch { /* first run: no settings yet */ } const os = String(app.getLocale?.() || "").slice(0, 2).toLowerCase(); return TEXTS[os] ? os : "fr"; } /** Text `key` in the player's language, {0}… replaced by `args`. */ function t(userData, key, ...args) { const table = TEXTS[language(userData)]; return String(table[key] ?? TEXTS.fr[key] ?? key).replace(/\{(\d+)\}/g, (_, i) => String(args[Number(i)] ?? "")); } module.exports = { t, language, TEXTS };