fix(i18n): spell brought-in units like the written ones, spread a range on one measured term, and keep the written order #165

Merged
abiwab merged 1 commit from fix/format-terms-spelling-range-order into dev/1.5 2026-11-15 21:33:43 +01:00
Owner

Three formatTerms defects seen while reviewing the recipe view (compound quantities, 1.5).

  • Spelling of a unit Gram brings in: {3/4 cup + 1-2 tbsp} scaled for a French reader gave … + 1 3/4-6 1/4 càc, a French spelling next to the written cup / tbsp. A brought-in unit now takes the reader's spelling only when a written unit already uses it (càs → càc), Gram's own otherwise (tsp): never a mix.
  • Range spread: the whole spread used to land on the last term (1 3/4-6 1/4 tsp, more than 2 tbsp). It now goes on the most precise term where both bounds are amounts its unit measures and the high one stays below the unit above: 1 cup + 3 1/2-5 tbsp. A scaled amount may round its bounds to what the unit measures (as the last term already did); an exact one must fall on it. 2 cup + 2-4 tbsp unchanged.
  • Written order kept: {1 cup - 2 tbsp + 30 g} read 1 cup + 30 g − 2 tbsp, which hid that each kind takes away on its own. The written order is kept; terms added are only moved first when the amount would start with a term taken away (1 cup − 2 tbsp, never −2 tbsp + 1 cup).

Goldens: only the fallback text of a sum of several kinds follows the written order (045: 1 cup - 2 tbsp + 30 g, was 1 cup + 30 g - 2 tbsp). Legacy digests unchanged. Docs (EN + FR): reference/api/i18n.mdx. No changeset: unreleased 1.5 behaviour.

Checks: lint, typecheck, 3179 tests (3 new in quantity.test.ts), conformance 120/120 + 24/24, check-changesets, docs build.

Three `formatTerms` defects seen while reviewing the recipe view (compound quantities, 1.5). - **Spelling of a unit Gram brings in**: `{3/4 cup + 1-2 tbsp}` scaled for a French reader gave `… + 1 3/4-6 1/4 càc`, a French spelling next to the written `cup` / `tbsp`. A brought-in unit now takes the reader's spelling only when a written unit already uses it (`càs` → `càc`), Gram's own otherwise (`tsp`): never a mix. - **Range spread**: the whole spread used to land on the last term (`1 3/4-6 1/4 tsp`, more than 2 tbsp). It now goes on the most precise term where both bounds are amounts its unit measures and the high one stays below the unit above: `1 cup + 3 1/2-5 tbsp`. A scaled amount may round its bounds to what the unit measures (as the last term already did); an exact one must fall on it. `2 cup + 2-4 tbsp` unchanged. - **Written order kept**: `{1 cup - 2 tbsp + 30 g}` read `1 cup + 30 g − 2 tbsp`, which hid that each kind takes away on its own. The written order is kept; terms added are only moved first when the amount would start with a term taken away (`1 cup − 2 tbsp`, never `−2 tbsp + 1 cup`). Goldens: only the fallback text of a sum of several kinds follows the written order (`045`: `1 cup - 2 tbsp + 30 g`, was `1 cup + 30 g - 2 tbsp`). Legacy digests unchanged. Docs (EN + FR): `reference/api/i18n.mdx`. No changeset: unreleased 1.5 behaviour. Checks: lint, typecheck, 3179 tests (3 new in `quantity.test.ts`), conformance 120/120 + 24/24, check-changesets, docs build.
abiwab merged commit fe36538c2d into dev/1.5 2026-11-15 21:33:43 +01:00
abiwab deleted branch fix/format-terms-spelling-range-order 2026-11-15 21:33:44 +01:00
Sign in to join this conversation.
No description provided.