chore(i18n): finish translating code comments and scripts to English
CI / Format and clippy (push) Successful in 1m57s
CI / Dependency audit (push) Successful in 13s
CI / Check desktop app (Linux) (push) Successful in 3m54s
CI / Tests (Linux) (push) Failing after 7m25s
Release / Create release (push) Successful in 6s
Release / CLI (linux-aarch64) (push) Successful in 1m48s
Release / CLI (linux-x86_64) (push) Successful in 2m39s
Release / Desktop app (linux-aarch64) (push) Successful in 10m9s
Release / Desktop app (linux-x86_64) (push) Successful in 12m20s
Release / Desktop app (windows) (push) Successful in 7m32s
Release / Build latest.json (push) Successful in 5s

Completes the English-only standardization for code, comments, scripts
and CI templates (UI/CLI-facing strings stay bilingual pt-BR/en,
untouched). Covers the remaining crates/, apps/gui/ui/ and
apps/gui/src-tauri/ comments, .gitea/ workflow and template comments,
.githooks/ hooks, and the scripts/ source comments for the files
already renamed in a prior commit (check.sh, generate-logo.py,
install-hooks.sh).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VAyr8d7HuAdUGB6aA5xmDD
This commit is contained in:
Lucas RayanandClaude Sonnet 5 committed 2026-10-30 20:43:02 -03:00
1 parent da212e6926
commit 6328220c60
129 files changed
+1961 -1834

No files matched your search

+30 -30
View File
@@ -1,5 +1,5 @@
// Guará: interface. Fala com o núcleo por `rpc(método, parâmetros)`:
// • app Tauri: invoke('rpc') • modo `guara ui`: POST /rpc/<método> com token.
// Guará: UI. Communicates with the core via `rpc(method, params)`:
// • Tauri app: invoke('rpc') • `guara ui` mode: POST /rpc/<method> with token.
import { createExplorer } from './explorer.js';
import { setLang, LOC, currentLang } from './i18n.js';
@@ -10,7 +10,7 @@ let token = params.get('token');
try {
if (token) sessionStorage.setItem('guara-token', token);
else token = sessionStorage.getItem('guara-token');
} catch { /* armazenamento indisponível */ }
} catch { /* storage unavailable */ }
async function rpc(method, p = {}) {
if (tauri?.core?.invoke) return tauri.core.invoke('rpc', { method, params: p });
@@ -29,7 +29,7 @@ const fileBase = tauri ? (isWin ? 'http://guara.localhost' : 'guara://localhost'
const thumbUrl = (job, id, s = 256) => `${fileBase}/thumb/${job}/${id}?s=${s}` + (tauri ? '' : `&t=${encodeURIComponent(token || '')}`);
const fileUrl = (job, id) => `${fileBase}/file/${job}/${id}` + (tauri ? '' : `?t=${encodeURIComponent(token || '')}`);
// Atualiza o HTML só quando mudou (evita piscar e perder o foco/hover).
// Update HTML only when changed (prevents flickering and losing focus/hover).
function setHTML(el, html) {
if (!el || el._h === html) return false;
el._h = html;
@@ -37,7 +37,7 @@ function setHTML(el, html) {
return true;
}
// ------------------------------------------------------------------ tema
// ------------------------------------------------------------------ theme
function applyTheme(t) {
const root = document.documentElement;
if (t === 'light' || t === 'dark') root.dataset.theme = t; else delete root.dataset.theme;
@@ -47,19 +47,19 @@ try { applyTheme(localStorage.getItem('guara-theme') || 'auto'); } catch { apply
document.querySelectorAll('[data-theme-pick]').forEach((b) => (b.onclick = async () => {
const t = b.dataset.themePick;
applyTheme(t);
try { localStorage.setItem('guara-theme', t); } catch { /* sem armazenamento */ }
try { localStorage.setItem('guara-theme', t); } catch { /* no storage */ }
saveSettings({ theme: t });
}));
// ------------------------------------------------------------------ configurações
// (declarado antes do uso: `S` é definido mais abaixo, por isso o objeto fica aqui)
// ------------------------------------------------------------------ settings
// (declared before use: `S` is defined further below, so the object lives here)
const SETTINGS = { theme: 'auto', lang: 'auto', ui_lang: null, notify: true, maps: false, updates: true };
async function saveSettings(patch) {
Object.assign(SETTINGS, patch);
try { await rpc('settings_set', SETTINGS); } catch { /* segue só com o armazenamento local */ }
try { await rpc('settings_set', SETTINGS); } catch { /* continue with local storage only */ }
}
// ------------------------------------------------------------------ utilidades
// ------------------------------------------------------------------ utilities
const $ = (s, el = document) => el.querySelector(s);
const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
const human = (n) => {
@@ -153,14 +153,14 @@ const S = {
sessions: [], // {job, target, label}
device: null, // {path,name,...}
layout: null,
job: null, // id da varredura atual
job: null, // active scan job id
status: null,
filters: { category: null, minConfidence: null, query: '', sort: 'confidence' },
items: [],
total: 0,
selected: new Set(),
allFiltered: false,
current: null, // arquivo em foco (pré-visualização)
current: null, // focused file (preview)
poll: null,
recJob: null,
};
@@ -259,7 +259,7 @@ $('#loadSessionBtn').onclick = async () => {
} catch (e) { info({ title: 'Não foi possível abrir a sessão', html: `<p>${esc(e.message)}</p>` }); }
};
// ------------------------------------------------------------------ início
// ------------------------------------------------------------------ home
function renderHome() {
main.classList.remove('fixed');
stopPoll();
@@ -278,7 +278,7 @@ function renderHome() {
$('#elevateHome')?.addEventListener('click', () => tauri.core.invoke('relaunch_elevated').catch((e) => toast(String(e))));
}
// ------------------------------------------------------------------ dispositivo
// ------------------------------------------------------------------ device
async function openDevice(d) {
main.classList.remove('fixed');
stopPoll();
@@ -291,7 +291,7 @@ async function openDevice(d) {
try { layout = await rpc('inspect', { path: d.path }); } catch (e) { err = e.message; }
S.layout = layout;
renderDevice(err);
// saúde (SMART) em segundo plano: não atrasa a tela
// Query SMART health in the background without blocking the screen.
rpc('health', { path: d.path }).then((h) => { if (S.device === d) { S.health = h; paintHealth(); } }).catch(() => {});
}
@@ -325,7 +325,7 @@ function paintHealth() {
${attrs.map((a) => `<tr><td><span class="h-dot ${esc(a.status)}" title="${HEALTH_WORD[a.status] || ''}"></span></td><td class="mono">${esc(a.id)}</td><td class="mono">${esc(a.name)}</td><td>${dash(a.value)}</td><td>${dash(a.worst)}</td><td>${dash(a.thresh)}</td><td class="mono">${esc(a.raw)}</td></tr>`).join('')}
</tbody></table></div></details>` : '';
const scope = h.partition ? `<p class="sub">O SMART é do disco inteiro: os dados abaixo são de <span class="mono">${esc(h.disk)}</span>, que contém <span class="mono">${esc(h.partition)}</span>.</p>` : '';
// o que motivou o alerta (os campos da ficha já aparecem abaixo)
// Fields that triggered the alert (standard summary fields appear below).
const known = new Set(['Modelo', 'Nº de série', 'Horas ligado', 'Temperatura', 'Autoavaliação SMART', 'Vida útil usada']);
const why = (h.details || []).filter(([k]) => !known.has(k)).map(([k, v]) => `<dt>${esc(k)}</dt><dd>${esc(v)}</dd>`).join('');
el.innerHTML = `${bad ? `<div class="notice ${h.status === 'failing' ? 'bad' : ''}">${warnSvg}<div><b>${esc(h.summary)}</b>
@@ -338,7 +338,7 @@ function paintHealth() {
$('#healthImg')?.addEventListener('click', startImage);
}
/** Disco com sinais de defeito: oferece criar a imagem antes de varrer. */
/** Disk showing signs of failure: offer to create a disk image before scanning. */
function confirmRisky() {
return new Promise((resolve) => {
const h = S.health;
@@ -532,8 +532,8 @@ function openSearch(job, terms) {
(async () => { while (await tick2()) await new Promise((r) => setTimeout(r, 700)); })();
}
// ------------------------------------------------------------------ varredura
let EX = null; // explorador de arquivos (grade, navegação, detalhes)
// ------------------------------------------------------------------ scan
let EX = null; // file explorer (grid, navigation, details)
function openJob(s) {
stopPoll();
@@ -556,7 +556,7 @@ async function tick() {
S.status = st;
paintStatus();
EX?.onStatus(st);
// continua consultando enquanto a varredura roda ou as datas/EXIF ainda estão sendo lidas
// Keep polling while the scan is running or dates/EXIF are still being enriched.
if (st.status !== 'running' && !st.enriching) {
stopPoll();
loadRecent();
@@ -615,7 +615,7 @@ function paintStatus() {
async function chooseSource() {
let cands = [];
try { cands = await rpc('session_candidates', { job: S.job }); } catch { /* segue só com o campo manual */ }
try { cands = await rpc('session_candidates', { job: S.job }); } catch { /* fall back to manual path input */ }
const st = S.status || {};
const size = st.layout?.size;
const d = $('#dlg');
@@ -711,7 +711,7 @@ async function recover(sel) {
} catch (e) { info({ title: 'Não foi possível recuperar', html: `<p>${esc(e.message)}</p>` }); }
}
// Modal de progresso de tarefas auxiliares (recuperação / imagem).
// Progress modal for auxiliary jobs (recovery / disk imaging).
function watchAux(job, title, doneHtml) {
const d = $('#dlg');
d.onclose = null;
@@ -740,7 +740,7 @@ function watchAux(job, title, doneHtml) {
async function openJobFromList(s) { openJob(s); }
// ------------------------------------------------------------------ configurações (janela)
// ------------------------------------------------------------------ settings modal
$('#settingsBtn')?.addEventListener('click', () => {
const d = $('#dlg');
d.innerHTML = `<form method="dialog"><h2>Configurações</h2>
@@ -764,9 +764,9 @@ $('#settingsBtn')?.addEventListener('click', () => {
d.showModal();
});
// ------------------------------------------------------------------ atualização do app
// O núcleo do app (Tauri) consulta o `latest.json` da release no Gitea, confere a assinatura do
// pacote com a chave pública embutida, instala e reabre. No navegador (`guara ui`) não há nada a fazer.
// ------------------------------------------------------------------ app updater
// The desktop shell (Tauri) queries `latest.json` from the Gitea release, verifies the
// package signature against the embedded public key, installs, and relaunches. No-op in browser mode (`guara ui`).
let UPD = null;
async function checkUpdate(manual) {
@@ -822,7 +822,7 @@ function updateProgress(p) {
}
}
// ------------------------------------------------------------------ fechar com varredura em andamento
// ------------------------------------------------------------------ close while scan is running
function askClose() {
return new Promise((resolve) => {
const d = $('#dlg');
@@ -848,14 +848,14 @@ function watchClose() {
try {
await rpc('scan_pause', { job: S.job });
for (let i = 0; i < 40; i++) { const st = await rpc('status', { job: S.job }); if (st.status !== 'running') break; await new Promise((r) => setTimeout(r, 250)); }
await new Promise((r) => setTimeout(r, 600)); // dá tempo do salvamento automático
} catch { /* sai mesmo assim */ }
await new Promise((r) => setTimeout(r, 600)); // allow auto-save to flush
} catch { /* exit anyway */ }
}
win.destroy();
});
}
// ------------------------------------------------------------------ início do app
// ------------------------------------------------------------------ app startup
(async function init() {
try {
const v = await rpc('version');