erplibre/.claude/skills/erplibre-doc-i18n/SKILL.md
Mathieu Benoit f2da91b0fe [REF] claude: trim the always-loaded guidance, and fix what it got wrong
Every session paid ~4 000 tokens for CLAUDE.md and .claude/rules/, and part of
that content no longer described this repository:

  CLAUDE.md and 05-environments.md gave .venv.odoo18/bin/python — a path that
  does not exist. The real one carries BOTH versions,
  .venv.odoo18.0_python3.12.10. 02-project-structure.md announced addons/ and
  odoo12.0/, absent from the checkout.

That is the reason for the cuts, more than the token count: the files drifted
from the repository, while « ls » cannot. What a session can rebuild by
reading the code is now left to the code.

  02-project-structure.md   deleted — a tree that ls gives, and gives right
  05-environments.md        deleted — a venv list that was simply false
  04-code-conventions.md    reduced to a pointer at .flake8, .editorconfig and
                            pyproject.toml, which already hold every value it
                            repeated, plus the Git conventions, which they
                            do not
  01-versions.md            table dropped for the pointer at
                            conf/supported_version_erplibre.json, whose keys
                            already pair Odoo with Python

Two blocks move to lazy loading — their body costs nothing until invoked:

  03-commands.md      -> skill erplibre-commands (kept whole: there is no
                         « make help » target, and the per-module test recipes
                         carry flags nobody would guess)
  07-documentation.md -> skill erplibre-doc-i18n for the how-to, while the
                         prohibition « never edit a generated .md » STAYS in
                         the rules: a rule that must hold at all times cannot
                         live in a file loaded on demand

Resident guidance: ~3 997 -> ~1 939 est. tokens per session.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-02 03:16:36 -04:00

60 lines
2.5 KiB
Markdown

---
name: erplibre-doc-i18n
description: Documentation bilingue ERPLibre (mmg, fichiers .base.md) et internationalisation du CLI TODO (todo_i18n.py, clés TRANSLATIONS). À charger pour rédiger ou régénérer de la documentation, ou pour ajouter une chaîne traduisible au CLI.
---
# Documentation multilingue
La documentation est bilingue (anglais/français) via **mmg** (Multilingual
Markdown Generator).
## Fonctionnement
- Les fichiers sources sont les `.base.md` (contiennent les deux langues)
- `mmg` génère : `FICHIER.md` (anglais) et `FICHIER.fr.md` (français)
- Marqueurs : `<!-- [en] -->`, `<!-- [fr] -->`, `<!-- [common] -->` (blocs de code partagés)
## Commandes
```bash
make doc_markdown # Regénérer toute la doc multilingue
```
## Convention
- Toujours modifier le fichier `.base.md` correspondant, puis exécuter `make doc_markdown`
- Les blocs de code vont dans `<!-- [common] -->`, le texte dans `<!-- [en] -->` et `<!-- [fr] -->`
- En-tête obligatoire dans chaque `.base.md` :
```
<!---------------------------->
<!-- multilingual suffix: en, fr -->
<!-- no suffix: en -->
<!---------------------------->
```
> Les fichiers concernés se listent par `find . -name '*.base.md'`.
## Internationalisation du CLI TODO (i18n)
Le CLI interactif `script/todo/todo.py` supporte le français et l'anglais.
### Architecture
- **`script/todo/todo_i18n.py`** — Module de traduction (dictionnaire `TRANSLATIONS`, fonctions `t()`, `get_lang()`, `set_lang()`)
- Les chaînes traduisibles utilisent `t("clé")` au lieu de texte en dur
- Les entrées de `todo.json` peuvent avoir un champ `prompt_description_key` résolu via `t()` (fallback sur `prompt_description`)
### Résolution de la langue (priorité)
1. `EL_LANG` dans `env_var.sh` (lu en premier, défaut `"fr"`)
2. Variable d'environnement `EL_LANG`
3. Défaut : `"fr"`
### Comportement
- Première exécution : prompt bilingue demande à l'utilisateur de choisir sa langue
- Le choix est persisté dans `env_var.sh`
- Changement de langue possible via TODO > Configuration > Langue
### Ajouter une traduction
1. Ajouter la clé dans `TRANSLATIONS` de `todo_i18n.py` avec les valeurs `"fr"` et `"en"`
2. Remplacer la chaîne en dur par `t("ma_clé")` dans `todo.py`
3. Pour les entrées JSON : ajouter `"prompt_description_key": "ma_clé"` dans `todo.json`
> La clé EST la chaîne anglaise. Vérifier l'absence de doublon dans
> `TRANSLATIONS` avant d'ajouter : une clé en double écrase silencieusement
> la précédente.