| 1 | // i18n ligero del «chrome» de Elffuss Code. El modelo ya responde en el idioma |
| 2 | // del navegador (agent.js → userLang); esto localiza los textos estáticos y de |
| 3 | // runtime de la UI (placeholder, indicadores «pensando/escribe», estado del |
| 4 | // modelo, saludo del proyecto, la Mente). ES por defecto — cero impacto en |
| 5 | // usuarios españoles — con inglés de fallback. Sustitución simple {var}. |
| 6 | const L = { |
| 7 | es: { |
| 8 | ph: 'Escribe aquí… (@ adjunta un archivo)', |
| 9 | thinking: 'Elffuss está pensando', writing: 'Elffuss escribe · {n} car.', using: 'Elffuss usa {name}', |
| 10 | modelLoading: 'Descargando el modelo IA · {pct}% · {loaded}/{total} MB', |
| 11 | modelReady: 'Modelo IA listo', modelReadyBadge: 'Modelo IA listo ✳', |
| 12 | welcome: '👋 Proyecto «{name}» abierto. Pregúntame por el código, pídeme cambios o dime «árbol». Todo se queda en tu máquina.', |
| 13 | mindTitle: 'MENTE DE ELFFUSS', avatarTitle: 'Mente de Elffuss — cerebro autónomo', |
| 14 | // landing (estático) + tooltips de la barra/toolbar |
| 15 | tagline: 'Abre tu carpeta de código y programa con una elfa al lado.', |
| 16 | tagline2: 'Editor tipo VS Code + agente <b>en tu navegador</b>. Nada sale de tu máquina. 😉', |
| 17 | openProject: '📁 Abrir carpeta de código', resume: 'Reanudar', discard: 'Descartar', cloneOpen: 'Descargar y abrir', |
| 18 | clonePh: 'pega la URL de un repo público (GitHub/Bitbucket)…', |
| 19 | searchPh: 'Buscar archivos por nombre (: para ir a línea, @ para símbolo, > para comandos)', |
| 20 | tFiles: 'Explorador', tSearch: 'Buscar (Cmd/Ctrl+P)', tArch: 'Arquitectura (grafo de dependencias)', |
| 21 | tCity: 'Ciudad 3D', tTerm: 'Terminal (Ctrl+`)', tSkills: 'Skills', tActSettings: 'Ajustes y modelo', |
| 22 | tGitBranch: 'rama actual', tHistory: 'Historial de conversaciones', tTopSettings: 'Ajustes, modelo y API keys', |
| 23 | tTermClose: 'cerrar (Ctrl+`)', tTermResize: 'arrastra para redimensionar', |
| 24 | tCtx: 'contexto acumulado en la conversación', tPlus: 'Adjuntar archivo del proyecto (@)', |
| 25 | tAutoedit: 'Editar archivos automáticamente', |
| 26 | tHardwork: 'Hard Work: lee tu proyecto entero por partes — audita, resume o busca en código que no cabe en el modelo', |
| 27 | tGoal: 'Modo Objetivo: descompone el mensaje en tareas y las ejecuta una a una (planificador + ejecutor)', |
| 28 | tFlip: 'cambiar entre chat y editor', tSlash: 'Comandos', |
| 29 | // pass-3: chrome profundo del IDE (paleta, menús, historial, ajustes, notifs) |
| 30 | tabClose: 'Cerrar pestaña (no borra la conversación)', newConv: 'Nueva conversación', |
| 31 | histEmpty: 'Sin conversaciones guardadas todavía.', histDel: 'Eliminar para siempre', |
| 32 | confirmDel: '¿Eliminar «{title}» para siempre?', thisConv: 'esta conversación', |
| 33 | cmdsSep: 'Comandos', slTree: 'árbol del proyecto', slSearch: 'buscar en el código', |
| 34 | slSkills: 'gestionar skills', slModel: 'proveedores y modelo', slClear: 'nueva conversación', |
| 35 | pTree: 'árbol', pSearch: 'busca ', pCommit: 'resume los cambios y prepárame el mensaje de commit', |
| 36 | pProposal: 'Implementa esta propuesta de mejora con cambios reales en el código:\n\n', |
| 37 | attachSep: 'Adjuntar al mensaje (@)', attachOpen: 'archivo abierto', openProjFirst: 'Abre un proyecto primero', |
| 38 | autoTxt: 'Auto', reviewTxt: 'Revisar', |
| 39 | autoOn: 'Editar archivos automáticamente (clic para revisar antes)', |
| 40 | autoOff: 'Pedir confirmación antes de escribir (clic para automático)', |
| 41 | pSearchCode: 'Buscar en el código…', pManageSkills: 'Gestionar skills', pToggleExplorer: 'Alternar explorador', |
| 42 | pToggleTerm: 'Alternar terminal', pSave: 'Guardar (Ctrl+S)', palCmd: 'comando', |
| 43 | palGotoSym: 'Ir a símbolo en el editor…', palEmpty: 'Sin resultados', |
| 44 | mNewFile: 'Nuevo archivo…', promptNewPath: 'Ruta del nuevo archivo:', mSave: 'Guardar', mOpenFolder: 'Abrir carpeta…', |
| 45 | mSearchCode: 'Buscar en el código', mGotoFile: 'Ir a archivo…', mGotoSym: 'Ir a símbolo…', |
| 46 | mTerminal: 'Terminal', mArch: 'Arquitectura', mAbout: 'Acerca de Elffuss Code (GitHub)', |
| 47 | gNotRepo: 'No es un repositorio git', gBranch: 'Rama: {b}', gLast: 'Último: {m}', gCommit: 'Pídele a Elffuss que commitee', |
| 48 | nExec: '▶ Ejecutar', nView: 'Ver en la Mente', |
| 49 | fallbackToast: 'Ese Gemma no cargó (memoria/GPU) — uso el ligero…', |
| 50 | setStoreTitle: 'Modelo descargado (se cachea en tu navegador)', setClear: 'Vaciar caché', setClearing: 'Vaciando…', |
| 51 | setCached: '{gb} en caché', setNone: 'Nada cacheado todavía', |
| 52 | setBrToken: 'Token (lo imprime el programa al arrancarlo)', brTokenPh: 'pega aquí el token…', |
| 53 | setFeedbackPh: 'Cuéntanos qué ha pasado o qué te gustaría que hiciera…', |
| 54 | lblModel: 'Modelo', lblApiKey: 'API key', |
| 55 | setCalc: 'Calculando espacio…', setPersist: '✓ almacenamiento persistente (no se borra solo)', |
| 56 | setNoPersist: '⚠ sin persistencia: el navegador podría desalojarlo', setLimit: ' · límite ~{gb}', |
| 57 | setModelPh: 'modelo (p. ej. gpt-4o-mini)', keyNeeded: 'clave (no necesaria)', |
| 58 | wsTitle: "Espacio de trabajo (tu disco)", |
| 59 | wsDesc: "Tus conversaciones y skills viven en este navegador, que puede borrarlas. Guárdalas en una carpeta y quedan como ficheros normales.", |
| 60 | wsNoSupport: "Este navegador no permite elegir carpeta. Usa «Descargar copia».", |
| 61 | wsNoFolder: "Sin carpeta: solo viven en este navegador.", |
| 62 | wsFolder: "Carpeta: {name}", |
| 63 | wsNeedsPerm: "«{name}» necesita permiso otra vez (pasa al recargar).", |
| 64 | wsPick: "Elegir carpeta", |
| 65 | wsUseProject: "Usar la del proyecto", |
| 66 | wsRegrant: "Conceder permiso", |
| 67 | wsSaveNow: "Guardar ahora", |
| 68 | wsSaved: "Guardado ({n} almacenes)", |
| 69 | wsAuto: "Guardar solo", |
| 70 | wsForget: "Olvidar carpeta", |
| 71 | wsDownload: "Descargar copia", |
| 72 | wsWhat: "Qué hay guardado", |
| 73 | setTitle: "Ajustes", |
| 74 | close: "cerrar", |
| 75 | setBrainTitle: "Cerebro (modelo)", |
| 76 | setModelE4bSub: "El mejor · WebGPU local · ~4 GB", |
| 77 | setModelE2bSub: "Ligero · WebGPU local · ~2 GB", |
| 78 | setModelOnnxSub: "Modelo propio · 850 MB · tool-calls + apps", |
| 79 | setModelRulesSub: "Órdenes directas, cero descarga", |
| 80 | setBridgeTitle: "🔌 Bridge local (ejecución real en tu máquina)", |
| 81 | setBridgeDisconnected: "desconectado", |
| 82 | setBridgeFolderPh: "/ruta/completa/a/tu/proyecto", |
| 83 | setBridgeConnect: "Conectar", |
| 84 | setBridgeOnStatus: "✓ conectado — ejecución real activa", |
| 85 | setBridgeNoToken: "⚠️ pega el token que imprimió el programa al arrancarlo", |
| 86 | setBridgeConnecting: "Conectando…", |
| 87 | setBridgeConnectedMsg: "✔ conectado — ejecución real en tu máquina", |
| 88 | setPermTitle: "✅ Permisos de ejecución", |
| 89 | setGoalTitle: "🎯 Modo Objetivo", |
| 90 | setTelTitle: "📨 Errores y feedback", |
| 91 | setTelEmpty: "escribe algo primero", |
| 92 | setTelThanks: "¡enviado, gracias!", |
| 93 | setProvTitle: "Proveedores externos (opcional · la clave se queda en tu navegador)", |
| 94 | setProvUse: "Usar", |
| 95 | setManageSkillsBtn: "Gestionar skills de Claude Code", |
| 96 | skRemove: "Quitar", |
| 97 | skBrowse: "Explorar", |
| 98 | skAddRepoPh: "owner/repo o URL de GitHub (p. ej. OpenClaude/…)", |
| 99 | skAddRepo: "Añadir repo", |
| 100 | hwPlaceholder: "⛏ Hard Work: pregunta algo sobre TODO el proyecto…", |
| 101 | hwNeedBrain: "Hard Work necesita un cerebro cargado: elige un modelo en Ajustes y reintenta.", |
| 102 | hwNeedProject: "Hard Work trabaja sobre tu proyecto. Abre una carpeta primero y vuelve a pulsar ⛏ Hard Work.", |
| 103 | hwReading: "Hard Work · leyendo el proyecto…", |
| 104 | hwNoFiles: "No encontré archivos de texto/código legibles en el proyecto.", |
| 105 | hwTrimmed: " — recortado", |
| 106 | hwPhaseReduce: "Hard Work · sintetizando…", |
| 107 | hwResultTrunc: " Proyecto recortado al máximo — acota con una subcarpeta.", |
| 108 | planPlanning: "planificando…", |
| 109 | planRunning: "ejecutando…", |
| 110 | planDone: "completado", |
| 111 | planFailed: "con fallos", |
| 112 | planStopped: "parado", |
| 113 | stopping: "Parando…", |
| 114 | stopped: "Parado.", |
| 115 | send: "Enviar", |
| 116 | stop: "Parar", |
| 117 | stModelLoadingAI: "Cargando el modelo IA…", |
| 118 | termCapsBridge: "🔌 Bridge local: node/npm/python reales", |
| 119 | termCapsNoBridge: "shell del proyecto · node/npm/python → Bridge local (⚙ Ajustes)", |
| 120 | setBridgeFolderLabel: "Carpeta de trabajo (opcional — si no, usa una temporal)", |
| 121 | setBridgeDesc: "Un pequeño programa que TÚ ejecutas en tu ordenador — le da a la elfa ejecución real (node, npm, python…) sin salir de tu máquina. Nada se instala en el navegador.", |
| 122 | setBridgeDownload: "⬇ Descargar para {os}", |
| 123 | setBridgeOtherOS: "otro sistema operativo", |
| 124 | setBridgeOld: "¿Ya tenías un bridge y ahora no conecta? Descárgalo otra vez (versión 1.1.1): los anteriores no aceptan la dirección nueva de Elffuss Code.", |
| 125 | setModelRulesName: "Básico (sin modelo)", |
| 126 | }, |
| 127 | en: { |
| 128 | ph: 'Type here… (@ attaches a file)', |
| 129 | thinking: 'Elffuss is thinking', writing: 'Elffuss writes · {n} chars', using: 'Elffuss uses {name}', |
| 130 | modelLoading: 'Downloading AI model · {pct}% · {loaded}/{total} MB', |
| 131 | modelReady: 'AI model ready', modelReadyBadge: 'AI model ready ✳', |
| 132 | welcome: '👋 Project “{name}” open. Ask me about the code, request changes, or say “tree”. Everything stays on your machine.', |
| 133 | mindTitle: 'ELFFUSS MIND', avatarTitle: 'Elffuss Mind — autonomous brain', |
| 134 | tagline: 'Open your code folder and program with an elf by your side.', |
| 135 | tagline2: 'VS Code–style editor + agent <b>in your browser</b>. Nothing leaves your machine. 😉', |
| 136 | openProject: '📁 Open code folder', resume: 'Resume', discard: 'Discard', cloneOpen: 'Download & open', |
| 137 | clonePh: 'paste the URL of a public repo (GitHub/Bitbucket)…', |
| 138 | searchPh: 'Search files by name (: to go to line, @ for symbol, > for commands)', |
| 139 | tFiles: 'Explorer', tSearch: 'Search (Cmd/Ctrl+P)', tArch: 'Architecture (dependency graph)', |
| 140 | tCity: '3D City', tTerm: 'Terminal (Ctrl+`)', tSkills: 'Skills', tActSettings: 'Settings & model', |
| 141 | tGitBranch: 'current branch', tHistory: 'Conversation history', tTopSettings: 'Settings, model & API keys', |
| 142 | tTermClose: 'close (Ctrl+`)', tTermResize: 'drag to resize', |
| 143 | tCtx: 'context accumulated in the conversation', tPlus: 'Attach a project file (@)', |
| 144 | tAutoedit: 'Edit files automatically', |
| 145 | tHardwork: 'Hard Work: reads your whole project in chunks — audits, summarises or searches code that does not fit in the model', |
| 146 | tGoal: 'Goal mode: breaks the message into tasks and runs them one by one (planner + executor)', |
| 147 | tFlip: 'switch between chat and editor', tSlash: 'Commands', |
| 148 | tabClose: 'Close tab (doesn’t delete the conversation)', newConv: 'New conversation', |
| 149 | histEmpty: 'No saved conversations yet.', histDel: 'Delete forever', |
| 150 | confirmDel: 'Delete “{title}” forever?', thisConv: 'this conversation', |
| 151 | cmdsSep: 'Commands', slTree: 'project tree', slSearch: 'search the code', |
| 152 | slSkills: 'manage skills', slModel: 'providers & model', slClear: 'new conversation', |
| 153 | pTree: 'tree', pSearch: 'search ', pCommit: 'summarize the changes and prepare my commit message', |
| 154 | pProposal: 'Implement this improvement proposal with real changes to the code:\n\n', |
| 155 | attachSep: 'Attach to message (@)', attachOpen: 'open file', openProjFirst: 'Open a project first', |
| 156 | autoTxt: 'Auto', reviewTxt: 'Review', |
| 157 | autoOn: 'Edit files automatically (click to review first)', |
| 158 | autoOff: 'Ask before writing (click for automatic)', |
| 159 | pSearchCode: 'Search the code…', pManageSkills: 'Manage skills', pToggleExplorer: 'Toggle explorer', |
| 160 | pToggleTerm: 'Toggle terminal', pSave: 'Save (Ctrl+S)', palCmd: 'command', |
| 161 | palGotoSym: 'Go to symbol in editor…', palEmpty: 'No results', |
| 162 | mNewFile: 'New file…', promptNewPath: 'New file path:', mSave: 'Save', mOpenFolder: 'Open folder…', |
| 163 | mSearchCode: 'Search the code', mGotoFile: 'Go to file…', mGotoSym: 'Go to symbol…', |
| 164 | mTerminal: 'Terminal', mArch: 'Architecture', mAbout: 'About Elffuss Code (GitHub)', |
| 165 | gNotRepo: 'Not a git repository', gBranch: 'Branch: {b}', gLast: 'Latest: {m}', gCommit: 'Ask Elffuss to commit', |
| 166 | nExec: '▶ Run', nView: 'View in the Mind', |
| 167 | fallbackToast: 'That Gemma didn’t load (memory/GPU) — using the light one…', |
| 168 | setStoreTitle: 'Downloaded model (cached in your browser)', setClear: 'Clear cache', setClearing: 'Clearing…', |
| 169 | setCached: '{gb} cached', setNone: 'Nothing cached yet', |
| 170 | setBrToken: 'Token (printed by the program on startup)', brTokenPh: 'paste the token here…', |
| 171 | setFeedbackPh: 'Tell us what happened or what you’d like it to do…', |
| 172 | lblModel: 'Model', lblApiKey: 'API key', |
| 173 | setCalc: 'Calculating space…', setPersist: '✓ persistent storage (won’t be auto-cleared)', |
| 174 | setNoPersist: '⚠ not persistent: the browser could evict it', setLimit: ' · limit ~{gb}', |
| 175 | setModelPh: 'model (e.g. gpt-4o-mini)', keyNeeded: 'key (not needed)', |
| 176 | wsTitle: "Workspace (your disk)", |
| 177 | wsDesc: "Your conversations and skills live in this browser, which can wipe them. Save them to a folder and they stay as normal files.", |
| 178 | wsNoSupport: "This browser can't pick a folder. Use «Download copy».", |
| 179 | wsNoFolder: "No folder: they only live in this browser.", |
| 180 | wsFolder: "Folder: {name}", |
| 181 | wsNeedsPerm: "«{name}» needs permission again (happens after a reload).", |
| 182 | wsPick: "Pick a folder", |
| 183 | wsUseProject: "Use the project's", |
| 184 | wsRegrant: "Grant permission", |
| 185 | wsSaveNow: "Save now", |
| 186 | wsSaved: "Saved ({n} stores)", |
| 187 | wsAuto: "Save automatically", |
| 188 | wsForget: "Forget folder", |
| 189 | wsDownload: "Download copy", |
| 190 | wsWhat: "What's stored", |
| 191 | setTitle: "Settings", |
| 192 | close: "close", |
| 193 | setBrainTitle: "Brain (model)", |
| 194 | setModelE4bSub: "The best · local WebGPU · ~4 GB", |
| 195 | setModelE2bSub: "Light · local WebGPU · ~2 GB", |
| 196 | setModelOnnxSub: "Our own model · 850 MB · tool-calls + apps", |
| 197 | setModelRulesSub: "Direct commands, zero download", |
| 198 | setBridgeTitle: "🔌 Local bridge (real execution on your machine)", |
| 199 | setBridgeDisconnected: "disconnected", |
| 200 | setBridgeFolderPh: "/full/path/to/your/project", |
| 201 | setBridgeConnect: "Connect", |
| 202 | setBridgeOnStatus: "✓ connected — real execution active", |
| 203 | setBridgeNoToken: "⚠️ paste the token the program printed on startup", |
| 204 | setBridgeConnecting: "Connecting…", |
| 205 | setBridgeConnectedMsg: "✔ connected — real execution on your machine", |
| 206 | setPermTitle: "✅ Execution permissions", |
| 207 | setGoalTitle: "🎯 Goal mode", |
| 208 | setTelTitle: "📨 Errors and feedback", |
| 209 | setTelEmpty: "type something first", |
| 210 | setTelThanks: "sent, thanks!", |
| 211 | setProvTitle: "External providers (optional · the key stays in your browser)", |
| 212 | setProvUse: "Use", |
| 213 | setManageSkillsBtn: "Manage Claude Code skills", |
| 214 | skRemove: "Remove", |
| 215 | skBrowse: "Browse", |
| 216 | skAddRepoPh: "owner/repo or GitHub URL (e.g. OpenClaude/…)", |
| 217 | skAddRepo: "Add repo", |
| 218 | hwPlaceholder: "⛏ Hard Work: ask something about the WHOLE project…", |
| 219 | hwNeedBrain: "Hard Work needs a loaded brain: pick a model in Settings and try again.", |
| 220 | hwNeedProject: "Hard Work works on your project. Open a folder first, then press ⛏ Hard Work again.", |
| 221 | hwReading: "Hard Work · reading the project…", |
| 222 | hwNoFiles: "I found no readable text/code files in the project.", |
| 223 | hwTrimmed: " — trimmed", |
| 224 | hwPhaseReduce: "Hard Work · synthesizing…", |
| 225 | hwResultTrunc: " Project trimmed to the max — narrow it down to a subfolder.", |
| 226 | planPlanning: "planning…", |
| 227 | planRunning: "running…", |
| 228 | planDone: "completed", |
| 229 | planFailed: "with failures", |
| 230 | planStopped: "stopped", |
| 231 | stopping: "Stopping…", |
| 232 | stopped: "Stopped.", |
| 233 | send: "Send", |
| 234 | stop: "Stop", |
| 235 | stModelLoadingAI: "Loading the AI model…", |
| 236 | termCapsBridge: "🔌 Local bridge: real node/npm/python", |
| 237 | termCapsNoBridge: "project shell · node/npm/python → Local bridge (⚙ Settings)", |
| 238 | setBridgeFolderLabel: "Working folder (optional — otherwise a temporary one is used)", |
| 239 | setBridgeDesc: "A small program that YOU run on your computer — it gives the elf real execution (node, npm, python…) without leaving your machine. Nothing is installed in the browser.", |
| 240 | setBridgeDownload: "⬇ Download for {os}", |
| 241 | setBridgeOtherOS: "another operating system", |
| 242 | setBridgeOld: "Already had a bridge and now it won't connect? Download it again (version 1.1.1): older ones don't accept Elffuss Code's new address.", |
| 243 | setModelRulesName: "Basic (no model)", |
| 244 | }, |
| 245 | }; |
| 246 | |
| 247 | // Idioma del chrome: 2 letras, ES por defecto. |
| 248 | export function uiLang() { |
| 249 | return (navigator.language || 'es').slice(0, 2).toLowerCase(); |
| 250 | } |
| 251 | |
| 252 | // Traduce una clave de runtime con sustitución {var}. Fallback: idioma → |
| 253 | // inglés → la propia clave. |
| 254 | export function t(key, vars) { |
| 255 | const s = (L[uiLang()] || L.en)[key] ?? L.en[key] ?? key; |
| 256 | return vars ? s.replace(/\{(\w+)\}/g, (_, k) => (vars[k] ?? '')) : s; |
| 257 | } |
| 258 | |
| 259 | // Textos estáticos del HTML (landing, placeholders, tooltips) que no pasan por |
| 260 | // t() en runtime. Se cablean una vez al arrancar; ES es el HTML por defecto. |
| 261 | export function applyI18n() { |
| 262 | document.documentElement.lang = uiLang(); |
| 263 | const set = (sel, prop, key) => { const e = document.querySelector(sel); if (e) e[prop] = t(key); }; |
| 264 | set('#prompt', 'placeholder', 'ph'); |
| 265 | const tag = document.querySelector('#landing .tag'); |
| 266 | if (tag) tag.innerHTML = `${t('tagline')}<br>${t('tagline2')}`; |
| 267 | set('#open-project', 'textContent', 'openProject'); |
| 268 | set('#resume-clone-btn', 'textContent', 'resume'); |
| 269 | set('#discard-clone-btn', 'textContent', 'discard'); |
| 270 | set('#clone-btn', 'textContent', 'cloneOpen'); |
| 271 | set('#clone-url', 'placeholder', 'clonePh'); |
| 272 | set('#pal-input', 'placeholder', 'searchPh'); |
| 273 | const titles = { |
| 274 | '#act-files': 'tFiles', '#act-search': 'tSearch', '#act-arch': 'tArch', '#act-city': 'tCity', |
| 275 | '#act-term': 'tTerm', '#act-skills': 'tSkills', '#act-settings': 'tActSettings', |
| 276 | '#git-branch': 'tGitBranch', '#btn-history': 'tHistory', '#btn-settings': 'tTopSettings', |
| 277 | '#term-close': 'tTermClose', '#term-resize': 'tTermResize', '#ctx-meter': 'tCtx', |
| 278 | '#btn-plus': 'tPlus', '#btn-autoedit': 'tAutoedit', '#btn-goal': 'tGoal', |
| 279 | '#btn-hardwork': 'tHardwork', |
| 280 | '#code-flip': 'tFlip', '#btn-slash': 'tSlash', '#btn-send': 'send', |
| 281 | }; |
| 282 | for (const [sel, key] of Object.entries(titles)) set(sel, 'title', key); |
| 283 | } |