Skip to content

studio: interface in English or French (FR/EN switch) - #5

Merged
ptrembli merged 1 commit into
mainfrom
feature/studio-i18n
Nov 28, 2026
Merged

ptrembli merged 1 commit into
mainfrom
feature/studio-i18n

Conversation

@ptrembli

Copy link
Copy Markdown
Contributor

canoP studio in English or French

canoP studio can now be used in English or in French, with a FR/EN switch in the top bar. The choice is saved in the studio settings. New installations start in English, and studios that were set up before keep French until the user switches.

How it works

  • The texts stay in French in the code and are wrapped in tr() (tools/canop_i18n.py). Their English translations are in tools/canop_i18n_en.py: 322 texts, grouped by file.
  • When the language changes:
    • each module recomputes the texts it keeps in the state (refresh_language());
    • the interface is rebuilt and pushed to the open pages.
  • Values that the code compares or stores stay as they were. For example, run states remain French identifiers, because they are stored in signac documents and read by the MCP tools; they are translated only when shown.
  • Files written by the studio, such as the # [canoP studio] lines of the run inis, do not depend on the language.
  • tools/trame/check_i18n.py checks that every tr() text has a translation with the same placeholders and {{ }} expressions. It runs in ctest (label unit, so in the CI) and as a pre-commit hook.
  • The templates of new runs (view) and of new campaigns (analysis.py) are translated. Existing runs and campaigns keep their own copies, in French.
  • The VS Code extension follows the language of VS Code (package.nls*.json).
  • The docs and the studio README use the English labels.

Tested

  • Isolated studio driven by a headless browser:
    • in English, all tabs, both settings panels and the new-campaign dialog were scanned for French text; only the campaign name hors-campagne (an identifier) is left;
    • a complete run was driven in English (blast example: load into the campaign, run, log, view);
    • 6 language switches over 2 page loads were all correct.
  • check_i18n.py: 322 texts, 0 errors.

Not tested

  • MCP tools.
  • Submitting a campaign through Slurm.
  • The VS Code extension inside VS Code (syntax check and a test against a stub API only).

The running studio has to be restarted after the merge.

🤖 Generated with Claude Code

The texts of canoP studio are written in French in the code and wrapped in tr() (tools/canop_i18n.py);
their English translations are in tools/canop_i18n_en.py (322 texts). The language is a setting of
the studio, switched in the top bar: the texts of the state are recomputed (refresh_language() of the
modules) and the interface is rebuilt once the update of the page is handled. New installations
start in English; settings saved without a language keep French.

- Values used by the logic stay as they are (run states, stored in signac documents and read by the
  MCP tools, are translated only when shown); files written by the studio (version lines of the
  inis) do not depend on the language.
- tools/trame/check_i18n.py checks that every tr() text has a translation with the same
  placeholders and {{ }} expressions: ctest (label unit) and pre-commit.
- The run view template and the analysis.py template of new campaigns are translated; existing runs
  and campaigns keep their copies.
- VS Code extension: follows the language of VS Code (package.nls*.json, a dictionary in
  extension.js).
- Docs and the studio README use the English labels; physics/<model>/ in a help text now shows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ptrembli
ptrembli merged commit 5620403 into main Nov 28, 2026
2 checks passed
@ptrembli
ptrembli deleted the feature/studio-i18n branch November 28, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant