diff --git a/src/components/lspInfoDialog/index.js b/src/components/lspInfoDialog/index.js index c6e0afeb4f..07b52f60f4 100644 --- a/src/components/lspInfoDialog/index.js +++ b/src/components/lspInfoDialog/index.js @@ -32,6 +32,15 @@ function getServerStatus(serverId) { } } +function getStatusLabel(status) { + const map = { + active: strings["lsp:active status"], + connecting: strings["lsp:connecting status"], + stopped: strings["lsp:stopped status"], + }; + return map[status] || status; +} + function getClientState(serverId) { const activeClients = getActiveClients(); return activeClients.find((c) => c.server?.id === serverId) || null; @@ -51,7 +60,7 @@ function getStatusColor(status) { function copyLogsToClipboard(serverId, serverLabel) { const logs = getLspLogs(serverId); if (logs.length === 0) { - toast("No logs to copy"); + toast(strings["lsp:no logs to copy"]); return; } @@ -71,18 +80,18 @@ function copyLogsToClipboard(serverId, serverLabel) { if (navigator.clipboard?.writeText) { navigator.clipboard.writeText(header + text).catch(() => { - toast("Failed to copy"); + toast(strings["lsp:failed to copy"]); }); } else if (cordova?.plugins?.clipboard) { cordova.plugins.clipboard.copy(header + text); } else { - toast("Clipboard not available"); + toast(strings["lsp:clipboard not available"]); } } async function restartServer(serverId) { addLspLog(serverId, "info", "Restart requested by user"); - toast("Restarting server..."); + toast(strings["lsp:restarting server"]); try { const clientState = getClientState(serverId); @@ -96,16 +105,16 @@ async function restartServer(serverId) { window.editorManager?.restartLsp?.(); addLspLog(serverId, "info", "Server restarted successfully"); - toast("Server restarted"); + toast(strings["lsp:server restarted"]); } catch (err) { addLspLog(serverId, "error", `Restart failed: ${err.message}`); - toast("Restart failed"); + toast(strings["lsp:restart failed"]); } } async function stopServer(serverId) { addLspLog(serverId, "info", "Stop requested by user"); - toast("Stopping..."); + toast(strings["lsp:stopping"]); try { const clientState = getClientState(serverId); @@ -117,20 +126,20 @@ async function stopServer(serverId) { stopManagedServer(serverId); addLspLog(serverId, "info", "Server stopped"); - toast("Server stopped"); + toast(strings["lsp:server stopped"]); } catch (err) { addLspLog(serverId, "error", `Stop failed: ${err.message}`); - toast("Failed to stop"); + toast(strings["lsp:failed to stop"]); } } async function startAllServers() { - toast("Starting LSP servers..."); + toast(strings["lsp:starting lsp servers"]); try { window.editorManager?.restartLsp?.(); - toast("Servers started"); + toast(strings["lsp:servers started"]); } catch (err) { - toast("Failed to start servers"); + toast(strings["lsp:failed to start servers"]); } } @@ -142,21 +151,27 @@ async function restartAllServers() { } const count = activeClients.length; - toast(`Restarting ${count} LSP server${count > 1 ? "s" : ""}...`); + const key = + count > 1 + ? "lsp:restarting lsp server plural" + : "lsp:restarting lsp server singular"; + const message = strings[key].replace("{count}", count); + + toast(message); try { await lspClientManager.dispose(); window.editorManager?.restartLsp?.(); - toast("All servers restarted"); + toast(strings["lsp:all servers restarted"]); } catch (err) { - toast("Failed to restart servers"); + toast(strings["lsp:failed to restart servers"]); } } async function stopAllServers() { const activeClients = getActiveClients(); if (!activeClients.length) { - toast("No LSP servers are currently running"); + toast(strings["lsp:no lsp servers are currently running"]); return; } @@ -164,9 +179,15 @@ async function stopAllServers() { try { await lspClientManager.dispose(); - toast(`Stopped ${count} LSP server${count > 1 ? "s" : ""}`); + const key = + count > 1 + ? "lsp:stopped lsp server plural" + : "lsp:stopped lsp server singular"; + const message = strings[key].replace("{count}", count); + + toast(message); } catch (err) { - toast("Failed to stop servers"); + toast(strings["lsp:failed to stop servers"]); } } @@ -187,7 +208,7 @@ function showLspInfoDialog() {
{proc.command}
{proc.ppid}
- Join our community of supporters and help shape the future of mobile - development -
+{strings["sponsors:join-our-community"]}