Translated referentials (FR / EN)

Several configurable referentials in Envergure can display their label in multiple languages. French is the pivot language (always stored on the entity itself); other languages are handled as secondary translations, which can be edited without touching the code or the pivot label.

How it works — FR pivot + translations

Each entity of a translatable referential carries:

  • a stable code (never translated, used as the business identifier — e.g. warehouse, operator, squadron);
  • a French label stored directly on the entity (pivot language);
  • zero or more translations (locale + label) stored in the polymorphic referential_labels table.

When the user navigates in a secondary language (EN today), the API returns the translated label if one exists. Otherwise it falls back to the French pivot label — there is never a missing string.

Translatable referentials today

The following endpoints accept the ?locale=fr|en query parameter:

Referential API endpoint Admin screen
Business unit types GET /business-unit-types /admin/business-unit-types
Partner types GET /partner-types /admin/partner-types
Storage types GET /storage-types /admin/storage-types

Other referentials already support translations on the backend but are not yet wired up to the web language switcher — they will be added as we touch them.

Entering an EN translation

  1. Open the admin screen for the referential (for example /admin/storage-types).
  2. For the relevant entity, open the translations dialog and enter the EN label.
  3. The code and the FR pivot label are left untouched.

Switching the UI to EN

The web app detects the language from (1) the locally stored preference, (2) the browser language, (3) defaulting to fr. To force a language:

  • use the language switcher in the sidebar (FR / EN);
  • or manually set the envergure.locale key in the browser’s localStorage.

Once the language is changed, screens that consume translatable referentials automatically display labels in the active language (with FR fallback when the translation is missing).

API contract

The ?locale parameter is strictly validated (fr or en). Any other value is rejected with 400 Bad Request. An absent parameter behaves like

fr.

GET /storage-types               → FR labels (pivot)
GET /storage-types?locale=en     → EN labels when translated, FR otherwise
GET /storage-types?locale=de     → 400 Bad Request

Going further

Full UI internationalisation (static strings, dates, numbers, mobile) is tracked separately — this chapter only covers the labels stored in the database for configurable referentials.