i18n: complete remaining roadmap tasks
CI / lint (push) Failing after 19s
CI / test (push) Has been skipped
CI / build (push) Has been skipped
CI / e2e (push) Has been skipped
CI / security (push) Failing after 11s

JS files:
- ai.js: add t() import, replace 10 hardcoded French strings
- sync.js: add t() import, replace 20 hardcoded French strings (toasts, status labels, events, AI panel)
- graph.js: add t() import, replace 6 hardcoded French strings (tooltips, badges)

Locales:
- +36 new keys for ai.js, sync.js, graph.js
- 1206 keys in each locale file (perfectly synchronized)
- 0 French characters remaining in en.json

Documentation:
- README.fr.md created (French version)
- ROADMAP.md point #63 updated to 100% complete
This commit is contained in:
2026-06-19 10:37:00 -04:00
parent 0bd2c12c13
commit 48023620e6
6 changed files with 213 additions and 41 deletions
+12 -11
View File
@@ -9,6 +9,7 @@
- AI Toolbox (to list, to table, frontmatter, to canvas)
*/
import { api } from './auth.js';
import { t } from './i18n.js';
// ── API call helper ──
async function aiAction(endpoint, text, extra = {}) {
@@ -270,7 +271,7 @@ export async function createAIToolbar(container, getEditorView) {
replaceSelection(v, result, 'append');
showToast(t('ai.completion_added'), 'success');
} catch (e) {
showToast('AI: ' + (String(e.message || e).includes('401') ? 'clé API invalide' : e.message), 'error');
showToast('AI: ' + (String(e.message || e).includes('401') ? t('ai.error_invalid_key') : e.message), 'error');
} finally {
aiBtn.innerHTML = origHTML;
aiBtn.disabled = false;
@@ -278,13 +279,13 @@ export async function createAIToolbar(container, getEditorView) {
});
// ── Edit menu ──
const editBtn = createDropdownBtn('Éditer', [
{ label: '🪄 Improve writing', action: () => action('improve'), hint: 'Améliore la qualité du texte' },
const editBtn = createDropdownBtn(t('ai.edit'), [
{ label: '🪄 Improve writing', action: () => action('improve'), hint: t('ai.hint_improve') },
{ label: '🔤 Fix spelling & grammar', action: () => action('fix-spelling'), hint: 'Corrige les fautes' },
{ label: '📏 Make shorter', action: () => action('make-shorter'), hint: 'Rend le texte plus concis' },
{ label: '📐 Make longer', action: () => action('make-longer'), hint: 'Ajoute des détails' },
{ label: '📐 Make longer', action: () => action('make-longer'), hint: t('ai.hint_add_details') },
{ label: '📋 Simplify language', action: () => action('simplify'), hint: 'Simplifie le langage' },
], 'Modifie le texte sélectionné');
], t('ai.hint_edit_selection'));
// ── Tone menu ──
const toneBtn = createDropdownBtn('Ton', [
@@ -300,14 +301,14 @@ export async function createAIToolbar(container, getEditorView) {
{ label: '🇩🇪 German', action: () => action('translate', { target_lang: 'German' }) },
{ label: '🇫🇷 French', action: () => action('translate', { target_lang: 'French' }) },
{ label: '🇪🇸 Spanish', action: () => action('translate', { target_lang: 'Spanish' }) },
], 'Traduit le texte sélectionné');
], t('ai.hint_translate'));
// ── Generate menu ──
const genBtn = createDropdownBtn('Générer', [
const genBtn = createDropdownBtn(t('ai.generate'), [
{ label: 'ℹ️ Explain this', action: () => action('explain', {}, 'append') },
{ label: '📝 Summarize', action: () => action('summarize', {}, 'append') },
{ label: '✏️ Continue writing', action: () => action('continue', {}, 'append') },
], 'Génère du contenu à partir de la sélection');
], t('ai.hint_generate'));
// ── Custom Rewrite ──
const rewriteBtn = document.createElement('button');
@@ -327,19 +328,19 @@ export async function createAIToolbar(container, getEditorView) {
const v = ev();
if (!v) return;
const text = getSelection(v);
const instruction = prompt('Instruction de réécriture :', '');
const instruction = prompt(t('ai.rewrite_prompt'), '');
if (!instruction) return;
try {
const result = await aiAction('rewrite', text, { instruction });
replaceSelection(v, result);
showToast(t('ai.text_rewritten'), 'success');
} catch (e) {
showToast('AI: ' + (String(e.message || e).includes('401') ? 'clé API invalide' : e.message), 'error');
showToast('AI: ' + (String(e.message || e).includes('401') ? t('ai.error_invalid_key') : e.message), 'error');
}
});
// ── Toolbox menu ──
const toolboxBtn = createDropdownBtn('🧰 Boîte', [
const toolboxBtn = createDropdownBtn(t('ai.toolbox'), [
{ label: '📋 Convert to list', action: () => action('to-list') },
{ label: '📊 Convert to table', action: () => action('to-table') },
{ label: '⚙️ Generate frontmatter', action: () => action('frontmatter', {}, 'before') },
+6 -5
View File
@@ -1,6 +1,7 @@
/* ObsiGate — Graph View: interactive file/folder relationship visualization.
Phase 2: theme colors, tooltips, depth slider, full-vault, search, backlinks. */
import { api } from './auth.js';
import { t } from './i18n.js';
import { safeCreateIcons } from './utils.js';
import { openFile } from './viewer.js';
@@ -624,8 +625,8 @@ export const GraphViewManager = {
if (fm.auteur) rows.push(`<div><span style="color:var(--text-muted)">✍️ Auteur</span> <span>${fm.auteur}</span></div>`);
if (fm.date || fm.creation_date) rows.push(`<div><span style="color:var(--text-muted)">📅 Date</span> <span>${fm.date || fm.creation_date}</span></div>`);
if (fm.statut) rows.push(`<div><span style="color:var(--text-muted)">📌 Statut</span> <span>${fm.statut}</span></div>`);
if (fm.catégorie || fm.categorie) rows.push(`<div><span style="color:var(--text-muted)">📂 Catégorie</span> <span>${fm.catégorie || fm.categorie}</span></div>`);
if (fm.publish) rows.push('<div><span style="color:var(--text-muted)">✅</span> <span>Publié</span></div>');
if (fm.catégorie || fm.categorie) rows.push(`<div><span style="color:var(--text-muted)">${t('graph.category')}</span> <span>${fm.catégorie || fm.categorie}</span></div>`);
if (fm.publish) rows.push('<div><span style="color:var(--text-muted)">✅</span> <span>${t('graph.published')}</span></div>');
if (fm.favoris) rows.push('<div><span style="color:var(--text-muted)">⭐</span> <span>Favoris</span></div>');
if (rows.length > 0) metaRows = rows.join('');
}
@@ -649,7 +650,7 @@ export const GraphViewManager = {
</div>
${metaRows ? `<div style="font-size:0.72rem;display:flex;flex-direction:column;gap:2px;padding:6px 0;border-top:1px solid var(--border-color);border-bottom:1px solid var(--border-color);margin-bottom:6px">${metaRows}</div>` : ''}
${tags.length > 0 ? `<div style="display:flex;gap:4px;flex-wrap:wrap">${tags.map(t => `<span style="font-size:0.65rem;background:var(--accent-color);color:#fff;padding:1px 6px;border-radius:3px;opacity:0.8">#${t}</span>`).join('')}</div>` : ''}
${node.type === 'file' ? '<div style="font-size:0.6rem;color:var(--text-muted);margin-top:6px;opacity:0.6">Ctrl+survol = aperçu complet</div>' : ''}
${node.type === 'file' ? '<div style="font-size:0.6rem;color:var(--text-muted);margin-top:6px;opacity:0.6">${t('graph.ctrl_hover_preview')}</div>' : ''}
`;
this._infoPanel.style.display = 'block';
},
@@ -671,7 +672,7 @@ export const GraphViewManager = {
if (fm.auteur) items.push(`✍️ ${fm.auteur}`);
if (fm.date || fm.creation_date) items.push(`📅 ${fm.date || fm.creation_date}`);
if (fm.statut) items.push(`📌 ${fm.statut}`);
if (fm.publish) items.push('✅ publié');
if (fm.publish) items.push('${t('graph.published_badge')}');
if (fm.favoris) items.push('⭐ favoris');
if (items.length > 0) fmSummary = `<div style="font-size:0.7rem;color:var(--text-muted);margin:4px 0">${items.join(' · ')}</div>`;
}
@@ -764,7 +765,7 @@ export const GraphViewManager = {
if (hit) {
this._canvas.style.cursor = 'pointer';
this._canvas.title = hit.node.type === 'file'
? `📄 ${hit.node.name} (cliquer pour ouvrir${e.ctrlKey ? ', Ctrl+survol = aperçu' : ''})`
? `📄 ${hit.node.name} (${t('graph.click_to_open')}${e.ctrlKey ? ', ${t('graph.ctrl_hover_preview_short')}' : ''})`
: `📁 ${hit.node.name} (cliquer pour explorer)`;
// Ctrl+hover: fetch content preview for file nodes
+22 -21
View File
@@ -1,5 +1,6 @@
/* ObsiGate — Sync: SSE client + PWA registration + Offline mode */
import { state } from './state.js';
import { t } from './i18n.js';
import { showToast } from './ui.js';
import { api } from './auth.js';
import { loadVaults, loadTags, refreshTagsForContext, refreshSidebarTreePreservingState } from './sidebar.js';
@@ -59,7 +60,7 @@ export const IndexUpdateManager = (() => {
try {
const data = JSON.parse(e.data);
_addEvent("vault_added", data);
showToast(`Vault "${data.vault}" ajouté (${data.stats.file_count} fichiers)`, "info");
showToast(t('sync.vault_added', { vault: data.vault, count: data.stats.file_count }), "info");
loadVaults();
loadTags();
} catch (err) {
@@ -71,7 +72,7 @@ export const IndexUpdateManager = (() => {
try {
const data = JSON.parse(e.data);
_addEvent("vault_removed", data);
showToast(`Vault "${data.vault}" supprimé`, "info");
showToast(t('sync.vault_removed', { vault: data.vault }), "info");
loadVaults();
loadTags();
} catch (err) {
@@ -85,7 +86,7 @@ export const IndexUpdateManager = (() => {
_addEvent("index_start", data);
connectionState = "syncing";
_updateBadge();
showToast(`Indexation démarrée (${data.total_vaults} vaults)`, "info");
showToast(t('sync.index_started', { count: data.total_vaults }), "info");
} catch (err) {
console.error("SSE parse error:", err);
}
@@ -110,7 +111,7 @@ export const IndexUpdateManager = (() => {
_addEvent("index_complete", data);
connectionState = "connected";
_updateBadge();
showToast(`Indexation terminée (${data.total_files} fichiers)`, "success");
showToast(t('sync.index_complete', { count: data.total_files }), "success");
loadVaults();
loadTags();
} catch (err) {
@@ -204,10 +205,10 @@ export const IndexUpdateManager = (() => {
if (!badge) return;
badge.className = "sync-badge sync-badge--" + connectionState;
const labels = {
disconnected: "Déconnecté",
disconnected: t('sync.disconnected'),
connecting: "Connexion...",
connected: "Synchronisé",
syncing: "Mise à jour...",
connected: t('sync.connected'),
syncing: t('sync.updating'),
};
badge.title = labels[connectionState] || connectionState;
}
@@ -289,9 +290,9 @@ function _renderSyncPanel(panel) {
const events = IndexUpdateManager.getRecentEvents();
const stateLabels = {
disconnected: "Déconnecté",
disconnected: t('sync.disconnected'),
connecting: "Connexion...",
connected: "Connecté",
connected: t('sync.connected_short'),
syncing: "Synchronisation...",
};
@@ -301,18 +302,18 @@ function _renderSyncPanel(panel) {
</div>`;
if (events.length === 0) {
html += `<div class="sync-panel__empty">Aucun événement récent</div>`;
html += `<div class="sync-panel__empty">${t('sync.no_recent_events')}</div>`;
} else {
html += `<div class="sync-panel__events">`;
events.slice(0, 10).forEach((ev) => {
const time = new Date(ev.timestamp).toLocaleTimeString();
const typeLabels = {
index_updated: "Mise à jour",
index_updated: t('sync.event_index_updated'),
index_reloaded: "Rechargement",
vault_added: "Vault ajouté",
vault_removed: "Vault supprimé",
index_start: "Démarrage index.",
index_progress: "Vault indexé",
vault_added: t('sync.event_vault_added'),
vault_removed: t('sync.event_vault_removed'),
index_start: t('sync.event_index_start'),
index_progress: t('sync.event_index_progress'),
index_complete: "Indexation tech.",
};
const label = typeLabels[ev.type] || ev.type;
@@ -378,7 +379,7 @@ function _renderAIStatusSection(panel) {
extClass = 'sync-panel__ai--inactive';
} else {
extIcon = 'help-circle';
extText = 'Vérification…';
extText = t('sync.verifying');
extClass = 'sync-panel__ai--unknown';
}
@@ -386,11 +387,11 @@ function _renderAIStatusSection(panel) {
let acIcon, acText, acClass;
if (_aiAutocomplete && _aiAutocomplete.available) {
acIcon = 'check-circle';
acText = 'Auto-complétion active';
acText = t('sync.autocomplete_active');
acClass = 'sync-panel__ai--active';
} else if (_aiAutocomplete && _aiAutocomplete.server_ok && !_aiAutocomplete.model_loaded) {
acIcon = 'alert-triangle';
acText = 'Modèle non chargé';
acText = t('sync.model_not_loaded');
acClass = 'sync-panel__ai--inactive';
} else if (_aiAutocomplete && _aiAutocomplete.error) {
acIcon = 'x-circle';
@@ -398,11 +399,11 @@ function _renderAIStatusSection(panel) {
acClass = 'sync-panel__ai--inactive';
} else if (_aiAutocomplete === null) {
acIcon = 'help-circle';
acText = 'Vérification…';
acText = t('sync.verifying');
acClass = 'sync-panel__ai--unknown';
} else {
acIcon = 'x-circle';
acText = 'Non configuré';
acText = t('sync.not_configured');
acClass = 'sync-panel__ai--inactive';
}
@@ -416,7 +417,7 @@ function _renderAIStatusSection(panel) {
'</span>' +
'</div>' +
'<div class="sync-panel__ai-row">' +
'<span class="sync-panel__ai-label">Auto-complétion</span>' +
'<span class="sync-panel__ai-label">' + t('sync.autocomplete') + '</span>' +
'<span class="sync-panel__ai-state ' + acClass + '" data-lucide-icon="' + acIcon + '">' +
'<i data-lucide="' + acIcon + '" style="width:14px;height:14px"></i>' +
acText +