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
This commit is contained in:
@@ -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
|
||||
('<p>Les fichiers markdown sont rendus avec :</p>',
|
||||
'help.desc_md_render', 'Markdown files are rendered with:', 'p'),
|
||||
|
||||
('<strong>Wikilinks cliquables</strong> :\n <code>[[lien]]</code> et\n <code>[[lien|texte]]</code>',
|
||||
'help.desc_wikilinks', ': <code>[[link]]</code> and <code>[[link|text]]</code>', 'strong'),
|
||||
|
||||
('<strong>Images Obsidian</strong> : Support\n de <code>![[image.png]]</code>',
|
||||
'help.desc_images', ': Supports <code>![[image.png]]</code>', 'strong'),
|
||||
|
||||
('<strong>Syntax highlighting</strong> :\n Coloration des blocs de code',
|
||||
'help.desc_syntax_hl', ': Code block highlighting', 'strong'),
|
||||
|
||||
('<strong>Tables, listes, quotes</strong> :\n Rendu complet du markdown',
|
||||
'help.desc_markdown_all', ': Full markdown rendering', 'strong'),
|
||||
|
||||
# File actions
|
||||
('Copier</strong> : Copie le contenu\n source dans le presse-papiers',
|
||||
'help.desc_copy_btn', ': Copies source content to clipboard', 'strong'),
|
||||
|
||||
('Source</strong> : Affiche/masque le\n markdown brut',
|
||||
'help.desc_source_btn', ': Shows/hides raw markdown', 'strong'),
|
||||
|
||||
('<strong\n >Ouvrir dans nouvelle fenêtre</strong\n >\n : Ouvre le fichier dans un nouvel onglet',
|
||||
'help.desc_open_new', ': Opens the file in a new tab', 'strong'),
|
||||
|
||||
# CodeMirror features
|
||||
('<strong>Coloration syntaxique</strong> :\n Support de nombreux langages',
|
||||
'help.desc_cm_syntax', ': Supports many languages', 'strong'),
|
||||
|
||||
('Numéros de ligne</strong> :\n Navigation facile',
|
||||
'help.desc_cm_lines', ': Easy navigation', 'strong'),
|
||||
|
||||
('Autocomplétion</strong> :\n Suggestions contextuelles',
|
||||
'help.desc_cm_autocomplete', ': Contextual suggestions', 'strong'),
|
||||
|
||||
('Recherche</strong> : Ctrl+F pour\n chercher dans le fichier',
|
||||
'help.desc_cm_search', ': Ctrl+F to search in the file', 'strong'),
|
||||
|
||||
('<strong>Sauvegarde</strong> : Bouton ✓ pour\n enregistrer',
|
||||
'help.desc_save_btn', ': ✓ button to save', 'strong'),
|
||||
|
||||
('<strong>Suppression</strong> : Bouton\n corbeille pour supprimer',
|
||||
'help.desc_delete_btn', ': Trash button to delete', 'strong'),
|
||||
|
||||
# ADVANCED EDITING section
|
||||
# h2 title
|
||||
('<h2 data-i18n=\"auto.f346076a\">✏️ Édition avancée</h2>',
|
||||
'help.adv_editing', '✏️ Advanced Editing', 'h2_direct'),
|
||||
|
||||
('<h3 data-i18n=\"auto.695d9e47\">Éditeur CodeMirror 6</h3>',
|
||||
'help.cm6_title', 'CodeMirror 6 Editor', 'h3_direct'),
|
||||
|
||||
# Editing features
|
||||
('<strong>Coloration syntaxique</strong> :\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'),
|
||||
|
||||
('<strong>Find in page</strong> : 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'),
|
||||
|
||||
('<strong>Bouton ✓</strong> : Sauvegarde\n manuelle',
|
||||
'help.desc_check_btn', ': Manual save', 'strong'),
|
||||
|
||||
('<strong>Bouton 🗑️</strong> : 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('<p>', f'<p data-i18n="{key}">')
|
||||
fr_val = old_snippet.replace('<p>','').replace('</p>','').strip()
|
||||
elif mode == 'strong':
|
||||
parts = old_snippet.split('</strong>')
|
||||
fr_val = parts[1].strip()
|
||||
new_snippet = parts[0] + '</strong><span data-i18n="' + key + '">' + fr_val + '</span>'
|
||||
elif mode == 'h2_direct':
|
||||
new_snippet = f'<h2 data-i18n="{key}">✏️ Advanced Editing</h2>'
|
||||
fr_val = '✏️ Édition avancée'
|
||||
elif mode == 'h3_direct':
|
||||
new_snippet = f'<h3 data-i18n="{key}">CodeMirror 6 Editor</h3>'
|
||||
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}')
|
||||
+34
-35
@@ -3177,24 +3177,24 @@
|
||||
<h2 data-i18n="help.c017944b">📄 Fichiers</h2>
|
||||
|
||||
<h3 data-i18n="help.cf8615b1">Visualisation</h3>
|
||||
<p>Les fichiers markdown sont rendus avec :</p>
|
||||
<p data-i18n="help.desc_md_render">Les fichiers markdown sont rendus avec :</p>
|
||||
<ul>
|
||||
<li>
|
||||
<strong>Wikilinks cliquables</strong> :
|
||||
<strong>Wikilinks cliquables</strong><span data-i18n="help.desc_wikilinks">:
|
||||
<code>[[lien]]</code> et
|
||||
<code>[[lien|texte]]</code>
|
||||
<code>[[lien|texte]]</code></span>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Images Obsidian</strong> : Support
|
||||
de <code>![[image.png]]</code>
|
||||
<strong>Images Obsidian</strong><span data-i18n="help.desc_images">: Support
|
||||
de <code>![[image.png]]</code></span>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Syntax highlighting</strong> :
|
||||
Coloration des blocs de code
|
||||
<strong>Syntax highlighting</strong><span data-i18n="help.desc_syntax_hl">:
|
||||
Coloration des blocs de code</span>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Tables, listes, quotes</strong> :
|
||||
Rendu complet du markdown
|
||||
<strong>Tables, listes, quotes</strong><span data-i18n="help.desc_markdown_all">:
|
||||
Rendu complet du markdown</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -3202,12 +3202,12 @@
|
||||
<p data-i18n="help.actions_detail">Boutons disponibles au-dessus du contenu :</p>
|
||||
<ul>
|
||||
<li>
|
||||
<strong data-i18n="viewer.copy">Copier</strong> : Copie le contenu
|
||||
source dans le presse-papiers
|
||||
<strong data-i18n="viewer.copy">Copier</strong><span data-i18n="help.desc_copy_btn">: Copie le contenu
|
||||
source dans le presse-papiers</span>
|
||||
</li>
|
||||
<li>
|
||||
<strong data-i18n="viewer.source">Source</strong> : Affiche/masque le
|
||||
markdown brut
|
||||
<strong data-i18n="viewer.source">Source</strong><span data-i18n="help.desc_source_btn">: Affiche/masque le
|
||||
markdown brut</span>
|
||||
</li>
|
||||
<li>
|
||||
<strong data-i18n="viewer.download">Télécharger</strong><span data-i18n="help.desc_a52fc3b1"> : Télécharge le
|
||||
@@ -3218,8 +3218,7 @@
|
||||
<li>
|
||||
<strong
|
||||
>Ouvrir dans nouvelle fenêtre</strong
|
||||
>
|
||||
: Ouvre le fichier dans un nouvel onglet
|
||||
><span data-i18n="help.desc_open_new">: Ouvre le fichier dans un nouvel onglet</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -3227,28 +3226,28 @@
|
||||
<p data-i18n="auto.edf89626">L'éditeur intégré offre :</p>
|
||||
<ul>
|
||||
<li>
|
||||
<strong>Coloration syntaxique</strong> :
|
||||
Support de nombreux langages
|
||||
<strong>Coloration syntaxique</strong><span data-i18n="help.desc_cm_syntax">:
|
||||
Support de nombreux langages</span>
|
||||
</li>
|
||||
<li>
|
||||
<strong data-i18n="auto.1d46301c">Numéros de ligne</strong> :
|
||||
Navigation facile
|
||||
<strong data-i18n="auto.1d46301c">Numéros de ligne</strong><span data-i18n="help.desc_cm_lines">:
|
||||
Navigation facile</span>
|
||||
</li>
|
||||
<li>
|
||||
<strong data-i18n="help.autocomplete">Autocomplétion</strong> :
|
||||
Suggestions contextuelles
|
||||
<strong data-i18n="help.autocomplete">Autocomplétion</strong><span data-i18n="help.desc_cm_autocomplete">:
|
||||
Suggestions contextuelles</span>
|
||||
</li>
|
||||
<li>
|
||||
<strong data-i18n="settings.search">Recherche</strong> : Ctrl+F pour
|
||||
chercher dans le fichier
|
||||
<strong data-i18n="settings.search">Recherche</strong><span data-i18n="help.desc_cm_search">: Ctrl+F pour
|
||||
chercher dans le fichier</span>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Sauvegarde</strong> : Bouton ✓ pour
|
||||
enregistrer
|
||||
<strong>Sauvegarde</strong><span data-i18n="help.desc_save_btn_new">: Bouton ✓ pour
|
||||
enregistrer</span>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Suppression</strong> : Bouton
|
||||
corbeille pour supprimer
|
||||
<strong>Suppression</strong><span data-i18n="help.desc_delete_btn_new">: Bouton
|
||||
corbeille pour supprimer</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -3292,29 +3291,29 @@
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
<strong>Coloration syntaxique</strong> :
|
||||
<strong>Coloration syntaxique</strong><span data-i18n="help.desc_adv_syntax">:
|
||||
Python, JS, HTML, CSS, Java, C++, Rust, Go
|
||||
et bien d'autres
|
||||
et bien d'autres</span>
|
||||
</li>
|
||||
<li>
|
||||
<strong data-i18n="auto.1d46301c">Numéros de ligne</strong><span data-i18n="help.desc_9f78b3ec"> :
|
||||
Navigation facilitée dans les fichiers longs</span></li>
|
||||
<li>
|
||||
<strong>Find in page</strong> : Ctrl+F pour
|
||||
<strong>Find in page</strong><span data-i18n="help.desc_find_in_page">: Ctrl+F pour
|
||||
chercher dans le fichier (casse, regex, mot
|
||||
entier)
|
||||
entier)</span>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Sauvegarde automatique</strong><span data-i18n="help.desc_065f53ee"> :
|
||||
Auto-save silencieux après 2s d'inactivité,
|
||||
flash vert de confirmation</span></li>
|
||||
<li>
|
||||
<strong>Bouton ✓</strong> : Sauvegarde
|
||||
manuelle
|
||||
<strong>Bouton ✓</strong><span data-i18n="help.desc_check_btn">: Sauvegarde
|
||||
manuelle</span>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Bouton 🗑️</strong> : Suppression du
|
||||
fichier
|
||||
<strong>Bouton 🗑️</strong><span data-i18n="help.desc_trash_btn">: Suppression du
|
||||
fichier</span>
|
||||
</li>
|
||||
<li>
|
||||
<strong data-i18n="help.toolbar_section">Barre d'outils AI</strong><span data-i18n="help.desc_c8532869"> :
|
||||
|
||||
@@ -687,9 +687,9 @@
|
||||
"auto.edf89626": "The built-in editor offers:",
|
||||
"auto.1d46301c": "Line numbers",
|
||||
"auto.ec7260fa": "Supported file types",
|
||||
"auto.f346076a": "✏️ Advanced editing",
|
||||
"auto.f346076a": "✏️ Advanced Editing",
|
||||
"auto.695d9e47": "CodeMirror 6 Editor",
|
||||
"auto.ef8c5f4d": "The built-in editor offers a complete experience",
|
||||
"auto.ef8c5f4d": "The built-in editor offers a complete editing experience:",
|
||||
"auto.aa8ca265": "The view uses the Barnes-Hut algorithm to calculate",
|
||||
"auto.337d8626": "Light/dark theme",
|
||||
"auto.1a8a8118": "Drag and drop",
|
||||
@@ -853,11 +853,11 @@
|
||||
"help.desc_828db5da": ": Both types are combined",
|
||||
"help.desc_b9c94994": ": Preview of the applied regex",
|
||||
"help.desc_ef3f8158": ": Manage your filtering patterns",
|
||||
"help.desc_a52fc3b1": ": Télécharge le\n fichier",
|
||||
"help.desc_995a711f": ": Ouvre l'éditeur\n CodeMirror",
|
||||
"help.desc_a52fc3b1": ": Downloads the file",
|
||||
"help.desc_995a711f": ": Opens the CodeMirror editor",
|
||||
"help.desc_9f78b3ec": ":\n Easier navigation in long files",
|
||||
"help.desc_065f53ee": ":\n Silent auto-save after 2s of inactivity,\n flash vert de confirmation",
|
||||
"help.desc_c8532869": ":\n Completion, rewrite, translation (voir\n section",
|
||||
"help.desc_065f53ee": ": Silent auto-save after 2s of inactivity, green confirmation flash",
|
||||
"help.desc_c8532869": ": Completion, rewrite, translation (see",
|
||||
"help.desc_e23c94dd": ": Dans la\n barre d'outils (le cas échéant)",
|
||||
"help.desc_f0adf67a": ": Molette pour\n zoomer, cliquer-glisser pour se déplacer",
|
||||
"help.desc_9edeaa11": ":\n Controls exploration depth (0-3)",
|
||||
@@ -946,5 +946,23 @@
|
||||
"help.desc_inline_tags": ": <code>#docker</code> in markdown content",
|
||||
"help.desc_template_intro": "In the Configurations, you can hide template tags:",
|
||||
"help.desc_patterns": ": Ex: <code>#<% ... %></code> or <code>#{{ ... }}</code>",
|
||||
"help.modal_title": "ObsiGate User Guide"
|
||||
"help.modal_title": "ObsiGate User Guide",
|
||||
"help.desc_md_render": "Markdown files are rendered with:",
|
||||
"help.desc_wikilinks": ": <code>[[link]]</code> and <code>[[link|text]]</code>",
|
||||
"help.desc_images": ": Supports <code>![[image.png]]</code>",
|
||||
"help.desc_syntax_hl": ": Code block highlighting",
|
||||
"help.desc_markdown_all": ": Full markdown rendering",
|
||||
"help.desc_copy_btn": ": Copies source content to clipboard",
|
||||
"help.desc_source_btn": ": Shows/hides raw markdown",
|
||||
"help.desc_open_new": ": Opens the file in a new tab",
|
||||
"help.desc_cm_syntax": ": Supports many languages",
|
||||
"help.desc_cm_lines": ": Easy navigation",
|
||||
"help.desc_cm_autocomplete": ": Contextual suggestions",
|
||||
"help.desc_cm_search": ": Ctrl+F to search in the file",
|
||||
"help.desc_save_btn_new": ": ✓ button to save",
|
||||
"help.desc_delete_btn_new": ": Trash button to delete",
|
||||
"help.desc_adv_syntax": ": Python, JS, HTML, CSS, Java, C++, Rust, Go and many more",
|
||||
"help.desc_find_in_page": ": Ctrl+F to search in the file (case, regex, whole word)",
|
||||
"help.desc_check_btn": ": Manual save",
|
||||
"help.desc_trash_btn": ": Delete file"
|
||||
}
|
||||
@@ -946,5 +946,23 @@
|
||||
"help.desc_inline_tags": ": <code>#docker</code> dans le contenu markdown",
|
||||
"help.desc_template_intro": "<p>\n Dans les Configurations, vous pouvez masquer les\n tags de template :\n </p>",
|
||||
"help.desc_patterns": ": Ex: <code>#<% ... %></code> ou <code>#{{ ... }}</code>",
|
||||
"help.modal_title": "Guide d'utilisation ObsiGate"
|
||||
"help.modal_title": "Guide d'utilisation ObsiGate",
|
||||
"help.desc_md_render": "Les fichiers markdown sont rendus avec :",
|
||||
"help.desc_wikilinks": ":\n <code>[[lien]]</code> et\n <code>[[lien|texte]]</code>",
|
||||
"help.desc_images": ": Support\n de <code>![[image.png]]</code>",
|
||||
"help.desc_syntax_hl": ":\n Coloration des blocs de code",
|
||||
"help.desc_markdown_all": ":\n Rendu complet du markdown",
|
||||
"help.desc_copy_btn": ": Copie le contenu\n source dans le presse-papiers",
|
||||
"help.desc_source_btn": ": Affiche/masque le\n markdown brut",
|
||||
"help.desc_open_new": ": Ouvre le fichier dans un nouvel onglet",
|
||||
"help.desc_cm_syntax": ":\n Support de nombreux langages",
|
||||
"help.desc_cm_lines": ":\n Navigation facile",
|
||||
"help.desc_cm_autocomplete": ":\n Suggestions contextuelles",
|
||||
"help.desc_cm_search": ": Ctrl+F pour\n chercher dans le fichier",
|
||||
"help.desc_save_btn_new": ": Bouton ✓ pour\n enregistrer",
|
||||
"help.desc_delete_btn_new": ": Bouton\n corbeille pour supprimer",
|
||||
"help.desc_adv_syntax": ":\n Python, JS, HTML, CSS, Java, C++, Rust, Go\n et bien d'autres",
|
||||
"help.desc_find_in_page": ": Ctrl+F pour\n chercher dans le fichier (casse, regex, mot\n entier)",
|
||||
"help.desc_check_btn": ": Sauvegarde\n manuelle",
|
||||
"help.desc_trash_btn": ": Suppression du\n fichier"
|
||||
}
|
||||
Reference in New Issue
Block a user