Repository navigation
[Maintainer] i18n: fix scoped-locale and decimal Bugbot findings from #1148 - #1162
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 95707a2277
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| measuredLengthUnits: scaledMeasuredLengthUnits, | ||
| metersPerUnit, | ||
| label: formatReferenceScaleLabel(displayLength, referenceScaleUnit), | ||
| label: formatReferenceScaleLabel(displayLength, referenceScaleUnit, locale), |
There was a problem hiding this comment.
Keep localized labels out of persisted guide data
When a reference scale is created under French, this stores a value such as 2,75 m in scaleReference.label; the floor-plan layer and reference panel subsequently render that persisted string verbatim. If the editor locale later changes, or another user opens the scene under a different locale, existing labels retain the creator's decimal convention and scene serialization now varies by locale. Persist the numeric value and unit (or a locale-neutral representation) and format the label with the active locale at render time.
Useful? React with 👍 / 👎.
| function roundToPrecision(value: number, precision: number): number { | ||
| const factor = 10 ** precision | ||
| return Math.round((value + Number.EPSILON) * factor) / factor |
There was a problem hiding this comment.
Preserve symmetric rounding for negative metric values
For metric controls that permit negative values, such as node-position controls, Math.round resolves exact negative half steps toward positive infinity. For example, at precision 1 this changes -1.25 to -1.2, whereas the previous toFixed path and the new Intl.NumberFormat display round it to -1.3; wheel or drag updates can therefore move a negative coordinate one quantum toward zero and disagree with the displayed value. Use a sign-symmetric rounding method consistent with the formatter.
Useful? React with 👍 / 👎.
|
Tooling cross-review at 95707a2: APPROVE
No P0 or P1 problems. P2 follow-ups (Codex, open on this head):
|
What does this PR do?
Follows up on #1148’s five remaining Bugbot findings:
ClientBootstrapsubscribes withdefaultI18n.subscribeLocale, which excludes catalog refresh notifications. Registering a later compiled pack therefore refreshes messages without applying the global English locale to the request scope. The regression now explicitly registers a compiled catalog while globalenand request-localfrdiffer, and verifies no locale notification or reset occurs.SliderControlgetslocalefromuseLocale()and callsparseSliderBareValue(text, locale), which forwards it toparseLocalizedNumber. The regression now explicitly keeps global localeenwhile rendering and parsing through a French scope.formatNumberno longer reads the live registry locale; its default is deterministic English and React renderers pass theuseLocale()snapshot explicitly. The SSR regression now asserts global English and request-local French simultaneously.Intl.NumberFormatfor idle, edit, reset, and arrow-key values. Slider write-back was already locale-aware and remains covered. The related floor-plan extrusion input now also preserves the scoped decimal separator after unit or locale changes.apps/editor/proxy.tsis unchanged.How to test
bun test packages/core/src/i18n packages/editor/src/components/ui/controls/slider-control.test.tsx packages/editor/src/components/ui/controls/metric-control.test.ts packages/editor/src/components/editor/floorplan-panel.test.ts packages/editor/src/components/editor-2d/floorplan-measurement-tool-layer.test.ts.bun run ci.2,75remains comma-formatted after committing metric, slider, extrusion, and reference-scale values.Screenshots / screen recording
N/A — non-visual formatting correctness change.
Checklist
bun devbun checkto verify)mainbranch