Skip to content

Internationalisation (i18n) / localisation pipeline #2

@PierreRaybaut

Description

@PierreRaybaut

Summary

Bring DataLab-Web to feature parity with DataLab Qt on translations: a working i18n pipeline covering the React UI, the Sigima labels surfaced through Pyodide, and the result formatting (units, dates, numbers).

Motivation

DataLab Qt ships French and English translations end-to-end (UI strings via gettext, computation/result labels via Sigima's _() wrapper, documentation via sphinx-intl). DataLab-Web currently has no translation layer: every label is hard-coded in English.

Architectural impact

  • Two translation domains to bridge: React/TS strings (probably FormatJS / LinguiJS / a thin t() helper) and Sigima Python strings already wrapped with _() but with no .mo loader inside Pyodide.
  • Bundle strategy: pre-bundle .mo files in the Vite build vs lazy-loaded per locale; impacts startup size.
  • Runtime locale switching: Sigima's gettext lookup is process-global — switching language at runtime requires re-instantiating translation objects on both sides and re-rendering the React tree (including auto-generated DataSetForms, which currently snapshot labels at mount).
  • Result formatting: numbers, units, dates rendered in tables and plot annotations need a locale-aware formatter (probably Intl.*); coordinate with Sigima's existing formatting helpers.
  • Documentation: a separate sphinx-intl pipeline for the user guide, mirroring DataLab desktop.

Acceptance criteria

  • A t() helper (or equivalent) covers every user-facing TS string; ESLint rule (or grep guard) flags hard-coded literals in src/components/.
  • Sigima .mo files are loaded inside Pyodide and a language switch in the UI propagates to DataLabRuntime (re-runs bindtextdomain and refreshes cached catalogs).
  • At least French and English are shipped, with a complete UI catalog and a Sigima catalog re-using the upstream .po files.
  • Documentation builds a localised HTML target (mirrors DataLab desktop's pipeline).
  • An E2E test asserts that switching language refreshes both UI strings (a menu label) and a Sigima-driven label (a parameter dialog title).

References

  • DataLab desktop pipeline: DataLab/.github/copilot-instructions.md → "Translations" section
  • Sigima: Sigima/sigima/locale/

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions