From 3736cc916857f8a7de7135038718b474e0f512ef Mon Sep 17 00:00:00 2001 From: BatLeDev Date: Fri, 13 Nov 2026 16:47:45 +0100 Subject: [PATCH 01/11] docs(skills): language policy of processing plugins - config forms: English base + x-i18n-*.fr for every public and new plugin, a French-only one translated fully the next time its schema is touched - logs and thrown errors in English - what a plugin writes into data (titles, columns, x-labels, product variants) stays in French for now: renaming a column breaks what is built on it - schema examples in English base with their French in x-i18n Co-Authored-By: Claude Opus 5.5 --- skills/data-fair-processing/SKILL.md | 2 +- skills/data-fair-processing/config-schema.md | 42 +++++++++++--------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/skills/data-fair-processing/SKILL.md b/skills/data-fair-processing/SKILL.md index 75899de..8b14c19 100644 --- a/skills/data-fair-processing/SKILL.md +++ b/skills/data-fair-processing/SKILL.md @@ -102,7 +102,7 @@ What to do with it: - **Every HTTP call goes through `context.axios`** — never the raw `axios` package, `axios.create()`, `fetch`, `got` or `request`, and never a custom `httpAgent`/`httpsAgent`/`proxy` option: they bypass the SSRF protection. Don't re-send credentials from the config (`Authorization`, API keys) to a next-page or resource URL whose origin differs from the configured API. Non-HTTP clients (ftp, sftp) and child processes: **READ the [data-fair-security skill](../data-fair-security/SKILL.md)**. - **POST/PATCH to data-fair** (bulk lines, file upload) are not retried: wrap them in a small helper retrying 429/5xx, with the body rebuilt by a thunk on each attempt. Reference: `processing-ods/lib/utils.ts` `withRetry429` / `dfRetry` (429 only, 3 retries, fixed 10 s pause, logs each pause). Don't wrap GETs — the built-in retry already applies, the two stack. - **Reading an error in code that runs in both worker and tests:** `err.status ?? err.response?.status`, `err.data ?? err.response?.data`. -- **Logging:** an error thrown from `run` is already turned by the worker into `log.error(" - - ()")` plus a `log.debug` of the trimmed error — just rethrow. When you catch to add context, `await log.error('what failed', err.response?.data ?? err.data)` (the second argument is a real `extra`), then rethrow. +- **Logging:** logs and error messages are in English (language policy in [config-schema.md](config-schema.md#internationalization-policy)). An error thrown from `run` is already turned by the worker into `log.error(" - - ()")` plus a `log.debug` of the trimmed error — just rethrow. When you catch to add context, `await log.error('what failed', err.response?.data ?? err.data)` (the second argument is a real `extra`), then rethrow. ### API key and vocabulary diff --git a/skills/data-fair-processing/config-schema.md b/skills/data-fair-processing/config-schema.md index c9a72b6..2c4f0da 100644 --- a/skills/data-fair-processing/config-schema.md +++ b/skills/data-fair-processing/config-schema.md @@ -20,8 +20,8 @@ Two independent jobs, same file: "layout": "tabs", "required": ["datasetMode", "url"], "allOf": [ - { "title": "Jeu de données", "oneOf": [ /* create / update */ ] }, - { "title": "Paramètres", "properties": { /* … */ } } + { "title": "Dataset", "x-i18n-title": { "fr": "Jeu de données" }, "oneOf": [ /* create / update */ ] }, + { "title": "Parameters", "x-i18n-title": { "fr": "Paramètres" }, "properties": { /* … */ } } ] } ``` @@ -34,29 +34,35 @@ Every plugin that produces a dataset exposes the same discriminated union on `da ```json { - "title": "Jeu de données", + "title": "Dataset", + "x-i18n-title": { "fr": "Jeu de données" }, "default": { "datasetMode": "update" }, "oneOf": [ { - "title": "Créer un jeu de données", + "title": "Create a dataset", + "x-i18n-title": { "fr": "Créer un jeu de données" }, "required": ["datasetMode"], "properties": { "datasetMode": { "type": "string", "const": "create", "title": "Action" }, "datasetTitle": { "type": "string", - "title": "Titre du jeu de données à créer", - "description": "Explication du mode création, rendue en aide contextuelle." + "title": "Title of the dataset to create", + "x-i18n-title": { "fr": "Titre du jeu de données à créer" }, + "description": "What the create mode does, shown as contextual help.", + "x-i18n-description": { "fr": "Explication du mode création, rendue en aide contextuelle." } } } }, { - "title": "Mettre à jour un jeu de données", + "title": "Update a dataset", + "x-i18n-title": { "fr": "Mettre à jour un jeu de données" }, "required": ["dataset"], "properties": { "datasetMode": { "type": "string", "const": "update", "title": "Action" }, "dataset": { "type": "object", - "title": "Jeu de données", + "title": "Dataset", + "x-i18n-title": { "fr": "Jeu de données" }, "layout": { "getItems": { "url": "${context.dataFairUrl}/api/v1/datasets?select=id,title&size=50&${context.ownerFilter}&raw=true", @@ -67,8 +73,8 @@ Every plugin that produces a dataset exposes the same discriminated union on `da } }, "properties": { - "id": { "type": "string", "title": "Identifiant" }, - "title": { "type": "string", "title": "Titre" } + "id": { "type": "string", "title": "Identifier" }, + "title": { "type": "string", "title": "Title" } } } } @@ -82,7 +88,7 @@ Every plugin that produces a dataset exposes the same discriminated union on `da In the `create` branch there is no dataset to point at — only a title to give the one that will be produced. Declare it as a **plain string property at branch level**, exactly like `processing-hello-world`: ```json -"datasetTitle": { "type": "string", "title": "Titre du jeu de données à créer" } +"datasetTitle": { "type": "string", "title": "Title of the dataset to create", "x-i18n-title": { "fr": "Titre du jeu de données à créer" } } ``` Wrapping it in a `"dataset": { "type": "object", "title": …, "properties": { "title": … } }` compiles to a `section` component, which renders a titled sub-block with its `description` as an always-visible markdown `subtitle`, wrapping a single field whose own label then repeats the same idea. Two headings and a paragraph for one text input. The flat form compiles to a bare `text-field` and pushes the `description` to the `help` icon — same information, one line. @@ -111,17 +117,17 @@ A field holding a real secret (password, API key) must pair its schema declarati ## Internationalization policy -The mechanism (`x-i18n-`, technical titles naming the generated types) is in the vjsf skill. The per-plugin policy: +The mechanism (`x-i18n-`, technical titles naming the generated types) is in the vjsf skill. The policy, by what the text is: -| Situation | What to do | +| Text | Language | |---|---| -| Config entirely in French | **Leave it in French.** No `x-i18n-*` at all. | -| Config in English, or half French / half English | **Internationalize it fully** — every user-facing label gets its `x-i18n-*.fr`. | -| New plugin | EN + fr from the start. | +| Config form (titles, descriptions, option labels, layout texts) | **English base + `x-i18n-*.fr`**, for every public plugin and every new one. A plugin still in French only gets translated fully the next time its schema is touched, never half: English in the base, the existing French moved into `x-i18n-*.fr`. | +| Logs (`log.*`) and thrown error messages | **English.** No translation: nothing tells the plugin the user's language. | +| What the plugin writes into data (dataset titles, column titles and descriptions, `x-labels`, product variants and variables) | **French for now**, unchanged until the maintainer decides otherwise: renaming a column breaks the datasets and applications already built on it. | ## Writing good descriptions -The `description` is rendered as **markdown** and is the only documentation most users read. Use it for behaviour that isn't obvious from the label: what happens on the remote server, what an empty value means, what the option does *not* affect. Bullet lists per case read well. Titles/descriptions are French in this stack. +The `description` is rendered as **markdown** and is the only documentation most users read. Use it for behaviour that isn't obvious from the label: what happens on the remote server, what an empty value means, what the option does *not* affect. Bullet lists per case read well. Write it in English in `description` and in French in `x-i18n-description.fr`. --- @@ -142,7 +148,7 @@ Generic schema traps (leftover `x-*`, `${context…}` templates, `item.` prefixe ## Checklist before committing a schema change - [ ] `grep -n '"x-' processing-config-schema.json` returns nothing but `x-exports` / `x-i18n-*` -- [ ] no half-translated config: if any label is in English, every user-facing label has its `x-i18n-*.fr` +- [ ] every user-facing label has an English base and its `x-i18n-*.fr` (no override with `en` alone) - [ ] `npm run build-types && npm run lint && npm test` - [ ] `git diff types/` reviewed — the generated type changed the way you expect - [ ] Existing configs still validate (no new `required` without `default`, no silent rename) From 2dd43915ad0a42afa3a36916a17f5bd4152c1a04 Mon Sep 17 00:00:00 2001 From: BatLeDev Date: Mon, 16 Nov 2026 09:21:13 +0100 Subject: [PATCH 02/11] docs(skills): one rule for dates and numbers in services and applications - dates: useLocaleDayjs() at every call site (getLocaleDayjs(lang) outside a component), never new Date().toLocaleString(locale), with the one exception of formats dayjs has no localized token for - numbers: toLocaleString(locale) without options is the simplest and fastest form, services use it and declare no numberFormats; a named n() format only for numbers with options in a render loop Co-Authored-By: Claude Opus 5.5 --- skills/data-fair-app/SKILL.md | 2 +- skills/data-fair-service/references/i18n.md | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/skills/data-fair-app/SKILL.md b/skills/data-fair-app/SKILL.md index 999c556..a957201 100644 --- a/skills/data-fair-app/SKILL.md +++ b/skills/data-fair-app/SKILL.md @@ -747,7 +747,7 @@ puis `const { t } = useI18n()` dans le `