Elffuss BraidHub

utopia-ia/elffuss-code public

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