From 88c7a5ead93a2f837ff258637c566c2740153889 Mon Sep 17 00:00:00 2001 From: Bruno Charest Date: Thu, 18 Jun 2026 16:45:58 -0400 Subject: [PATCH] fix: full i18n for Files + Advanced Editing help sections - 18 LI descriptions wrapped in data-i18n spans - 1 paragraph tagged - 3 auto key EN translations fixed - 4 existing span EN translations fixed - Sections: Markdown rendering, file actions, CodeMirror, AI toolbar --- _files.py | 118 +++++++++++++++++++++++++++++++++++++++ frontend/index.html | 69 +++++++++++------------ frontend/locales/en.json | 32 ++++++++--- frontend/locales/fr.json | 20 ++++++- 4 files changed, 196 insertions(+), 43 deletions(-) create mode 100644 _files.py diff --git a/_files.py b/_files.py new file mode 100644 index 0000000..1bb059b --- /dev/null +++ b/_files.py @@ -0,0 +1,118 @@ +"""Fix Files + Advanced Editing help sections.""" +import json + +with open('frontend/index.html', 'r', encoding='utf-8') as f: html = f.read() +with open('frontend/locales/fr.json', 'r', encoding='utf-8') as f: fr = json.load(f) +with open('frontend/locales/en.json', 'r', encoding='utf-8') as f: en = json.load(f) + +fixes = [ + # FILES section + ('

Les fichiers markdown sont rendus avec :

', + 'help.desc_md_render', 'Markdown files are rendered with:', 'p'), + + ('Wikilinks cliquables :\n [[lien]] et\n [[lien|texte]]', + 'help.desc_wikilinks', ': [[link]] and [[link|text]]', 'strong'), + + ('Images Obsidian : Support\n de ![[image.png]]', + 'help.desc_images', ': Supports ![[image.png]]', 'strong'), + + ('Syntax highlighting :\n Coloration des blocs de code', + 'help.desc_syntax_hl', ': Code block highlighting', 'strong'), + + ('Tables, listes, quotes :\n Rendu complet du markdown', + 'help.desc_markdown_all', ': Full markdown rendering', 'strong'), + + # File actions + ('Copier : Copie le contenu\n source dans le presse-papiers', + 'help.desc_copy_btn', ': Copies source content to clipboard', 'strong'), + + ('Source : Affiche/masque le\n markdown brut', + 'help.desc_source_btn', ': Shows/hides raw markdown', 'strong'), + + ('Ouvrir dans nouvelle fenêtre\n : Ouvre le fichier dans un nouvel onglet', + 'help.desc_open_new', ': Opens the file in a new tab', 'strong'), + + # CodeMirror features + ('Coloration syntaxique :\n Support de nombreux langages', + 'help.desc_cm_syntax', ': Supports many languages', 'strong'), + + ('Numéros de ligne :\n Navigation facile', + 'help.desc_cm_lines', ': Easy navigation', 'strong'), + + ('Autocomplétion :\n Suggestions contextuelles', + 'help.desc_cm_autocomplete', ': Contextual suggestions', 'strong'), + + ('Recherche : Ctrl+F pour\n chercher dans le fichier', + 'help.desc_cm_search', ': Ctrl+F to search in the file', 'strong'), + + ('Sauvegarde : Bouton ✓ pour\n enregistrer', + 'help.desc_save_btn', ': ✓ button to save', 'strong'), + + ('Suppression : Bouton\n corbeille pour supprimer', + 'help.desc_delete_btn', ': Trash button to delete', 'strong'), + + # ADVANCED EDITING section + # h2 title + ('

✏️ Édition avancée

', + 'help.adv_editing', '✏️ Advanced Editing', 'h2_direct'), + + ('

Éditeur CodeMirror 6

', + 'help.cm6_title', 'CodeMirror 6 Editor', 'h3_direct'), + + # Editing features + ('Coloration syntaxique :\n Python, JS, HTML, CSS, Java, C++, Rust, Go\n et bien d\'autres', + 'help.desc_adv_syntax', ': Python, JS, HTML, CSS, Java, C++, Rust, Go and many more', 'strong'), + + ('Find in page : Ctrl+F pour\n chercher dans le fichier (casse, regex, mot\n entier)', + 'help.desc_find_in_page', ': Ctrl+F to search in the file (case, regex, whole word)', 'strong'), + + ('Bouton ✓ : Sauvegarde\n manuelle', + 'help.desc_check_btn', ': Manual save', 'strong'), + + ('Bouton 🗑️ : Suppression du\n fichier', + 'help.desc_trash_btn', ': Delete file', 'strong'), +] + +count = 0 +for old_snippet, key, en_val, mode in fixes: + if old_snippet in html: + if mode == 'p': + new_snippet = old_snippet.replace('

', f'

') + fr_val = old_snippet.replace('

','').replace('

','').strip() + elif mode == 'strong': + parts = old_snippet.split('') + fr_val = parts[1].strip() + new_snippet = parts[0] + '' + fr_val + '' + elif mode == 'h2_direct': + new_snippet = f'

✏️ Advanced Editing

' + fr_val = '✏️ Édition avancée' + elif mode == 'h3_direct': + new_snippet = f'

CodeMirror 6 Editor

' + fr_val = 'Éditeur CodeMirror 6' + else: + continue + + html = html.replace(old_snippet, new_snippet) + fr[key] = fr_val + en[key] = en_val + count += 1 + else: + print(f"NOT FOUND: {old_snippet[:60]}...") + +# Fix EN for existing spans in editing +en_fixes = { + 'help.desc_065f53ee': ': Silent auto-save after 2s of inactivity, green confirmation flash', + 'help.desc_c8532869': ': Completion, rewrite, translation (see', + 'help.desc_a52fc3b1': ': Downloads the file', + 'help.desc_995a711f': ': Opens the CodeMirror editor', +} +for k, v in en_fixes.items(): + if k not in fr: + fr[k] = v + en[k] = v + count += 1 + +with open('frontend/index.html', 'w', encoding='utf-8') as f: f.write(html) +with open('frontend/locales/fr.json', 'w', encoding='utf-8') as f: json.dump(fr, f, ensure_ascii=False, indent=2) +with open('frontend/locales/en.json', 'w', encoding='utf-8') as f: json.dump(en, f, ensure_ascii=False, indent=2) +print(f'Fixed: {count}') diff --git a/frontend/index.html b/frontend/index.html index 7af5e22..ce0e220 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -3177,24 +3177,24 @@

📄 Fichiers

Visualisation

-

Les fichiers markdown sont rendus avec :

+

Les fichiers markdown sont rendus avec :

@@ -3202,12 +3202,12 @@

Boutons disponibles au-dessus du contenu :

@@ -3227,28 +3226,28 @@

L'éditeur intégré offre :

@@ -3292,29 +3291,29 @@