i18n: complete audit — 55 new keys, all hardcoded strings converted to t()
- Added 4 missing keys: button.cancel, toast.dir_renamed, toast.file_deleted, toast.file_renamed
- Replaced 41 hardcoded showToast() strings with t() calls across 13 JS files
- Replaced 10 hardcoded textContent/title/innerHTML strings with t() calls
- Fixed theme labels: Sombre/Clair -> t('theme.dark')/t('theme.light')
- Fixed vault selector: Tous les vaults -> t('help.all_vaults')
- Both locale files: 983 -> 1032 keys, perfectly matched
- Bidirectional EN<->FR switching verified in browser
This commit is contained in:
+11
-11
@@ -220,7 +220,7 @@ export async function createAIToolbar(container, getEditorView) {
|
||||
if (!aiConfigured) {
|
||||
const hint = document.createElement('div');
|
||||
hint.style.cssText = 'padding:6px 12px;font-size:0.7rem;color:var(--text-muted);border-bottom:1px solid var(--border-color)';
|
||||
hint.textContent = '⚠️ AI non configuré — ajouter DEEPSEEK_API_KEY, OPENROUTER_API_KEY ou GEMINI_API_KEY dans .env';
|
||||
hint.textContent = t('ai.not_configured');
|
||||
container.appendChild(hint);
|
||||
return;
|
||||
}
|
||||
@@ -256,7 +256,7 @@ export async function createAIToolbar(container, getEditorView) {
|
||||
padding: '3px 8px',
|
||||
borderRadius: '4px',
|
||||
});
|
||||
aiBtn.title = 'AI Inline Completion (Ctrl+J) — Complète le texte automatiquement';
|
||||
aiBtn.title = t('ai.inline_completion_title');
|
||||
aiBtn.addEventListener('click', async () => {
|
||||
const v = ev();
|
||||
if (!v) return;
|
||||
@@ -268,7 +268,7 @@ export async function createAIToolbar(container, getEditorView) {
|
||||
try {
|
||||
const result = await aiAction('inline-complete', text);
|
||||
replaceSelection(v, result, 'append');
|
||||
showToast('AI: complétion ajoutée', 'success');
|
||||
showToast(t('ai.completion_added'), 'success');
|
||||
} catch (e) {
|
||||
showToast('AI: ' + (String(e.message || e).includes('401') ? 'clé API invalide' : e.message), 'error');
|
||||
} finally {
|
||||
@@ -312,8 +312,8 @@ export async function createAIToolbar(container, getEditorView) {
|
||||
// ── Custom Rewrite ──
|
||||
const rewriteBtn = document.createElement('button');
|
||||
rewriteBtn.className = 'ai-toolbar-btn';
|
||||
rewriteBtn.innerHTML = '💬 Réécrire';
|
||||
rewriteBtn.title = 'Réécrit le texte selon vos instructions';
|
||||
rewriteBtn.innerHTML = t('ai.rewrite');
|
||||
rewriteBtn.title = t('ai.rewrite_title');
|
||||
Object.assign(rewriteBtn.style, {
|
||||
fontSize: '0.7rem',
|
||||
background: 'transparent',
|
||||
@@ -332,7 +332,7 @@ export async function createAIToolbar(container, getEditorView) {
|
||||
try {
|
||||
const result = await aiAction('rewrite', text, { instruction });
|
||||
replaceSelection(v, result);
|
||||
showToast('AI: texte réécrit', 'success');
|
||||
showToast(t('ai.text_rewritten'), 'success');
|
||||
} catch (e) {
|
||||
showToast('AI: ' + (String(e.message || e).includes('401') ? 'clé API invalide' : e.message), 'error');
|
||||
}
|
||||
@@ -364,10 +364,10 @@ export async function createAIToolbar(container, getEditorView) {
|
||||
if (!v) return;
|
||||
const text = getSelection(v);
|
||||
if (!text.trim()) {
|
||||
showToast('AI: sélectionnez du texte à traiter', 'warning');
|
||||
showToast(t('ai.select_text'), 'warning');
|
||||
return;
|
||||
}
|
||||
showToast('⏳ AI: traitement en cours...', 'info');
|
||||
showToast(t('ai.processing'), 'info');
|
||||
|
||||
// Show processing indicator in the editor header
|
||||
_showProcessingIndicator(true);
|
||||
@@ -377,13 +377,13 @@ export async function createAIToolbar(container, getEditorView) {
|
||||
try {
|
||||
const result = await aiAction(endpoint, text, extra);
|
||||
replaceSelection(v, result, mode);
|
||||
showToast('AI: texte traité ✓', 'success');
|
||||
showToast(t('ai.text_processed'), 'success');
|
||||
} catch (e) {
|
||||
const msg = String(e.message || e);
|
||||
if (msg.includes('401')) {
|
||||
showToast('AI: clé API invalide. Vérifiez DEEPSEEK_API_KEY dans .env', 'error');
|
||||
showToast(t('ai.invalid_api_key'), 'error');
|
||||
} else if (msg.includes('402') || msg.includes('429')) {
|
||||
showToast('AI: quota dépassé ou paiement requis', 'error');
|
||||
showToast(t('ai.quota_exceeded'), 'error');
|
||||
} else {
|
||||
showToast('AI: ' + msg, 'error');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user