Skip to content

i18n: make the renderer localizable (UI strings + date formats) #1996

Description

@oliveregger

Problem

@aehrc/smart-forms-renderer currently hardcodes its user-facing UI text in English and renders dates in a fixed DD/MM/YYYY format. There is no supported way for a consuming app to localize the renderer's own output.

Examples of text/behavior that cannot currently be localized:

  • Boolean item options are always Yes / No (no way to render Ja / Nein, Oui / Non, Sì / No).
  • Date fields always display/parse as DD/MM/YYYY (e.g. Switzerland needs DD.MM.YYYY).
  • Date validation error messages are English-only.

Motivation / use case

We are evaluating Smart Forms for use in Switzerland, which has four official languages (German, French, Italian, Romansh). Forms must present the renderer's UI and date formatting in the user's language/region — e.g. a Swiss‑German form should show Ja/Nein and 31.12.2024, not Yes/No and 31/12/2024.

This is distinct from translating the questionnaire content (item.text, answer option displays), which FHIR already standardizes via Questionnaire.language + the translation extension. The gap here is the renderer-owned "chrome" (labels, messages, date formatting) that lives in the component code, plus locale-aware date handling.

Desired outcome

A way to configure the renderer's language/region so that:

  • renderer-owned UI strings resolve to the active locale (with sensible English defaults),
  • dates format, parse, and validate according to the locale (with an override),
  • it stays opt-in and backward-compatible (English / DD/MM/YYYY unchanged by default),
  • consumers can supply their own translations without the library imposing an i18n framework.

Scope

  • In scope (this request): renderer chrome — boolean labels, date format/validation, validation messages.
  • Follow-up (separate): FHIR content translation via Questionnaire.language + _text translation extensions.

Proposal

A draft RFC PR exploring one approach (config-injected string catalog + Intl-derived date formats) is open for discussion: #1995. Seeking the team's view on whether this is a direction to pursue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions