feat(i18n): localize toast notifications and placement errors - #43
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found by a swarm audit hunting for user-facing strings that never reach a locale file — the same class of bug as the tooltips (#38) and the PDF disclaimers (#42), but larger.
The gap
23
notify.*calls used literal English; only 2 places in the whole app usedt(). SolarSim advertises full en/ms/zh support, but every toast on the Workbench and Analysis pages was English-only — including the ones a user hits most while actually editing a layout.Also three placement-rejection messages in
useCanvasInteractions.ts('That placement overlaps another panel.'and friends), which surface throughnotify.errorwhen a drag is refused.13 real user-facing strings in total. The 24th match was a comment in
toastConfig.tsx, not a finding.Changes
toastsblocks added toworkbench.json(11 keys) andanalysis.json(2 keys) in all three locales.useTranslationwired into the four hooks that own these messages —useCanvasInteractions,useWorkbenchSave,useOverlayImages,useAnalysisPdf. None of them imported it before.{{count}}for panel counts,{{filename}},{{mode}},{{reason}}.getPlacementErrorMessagenow takesTFunction— it is a module-level helper, sothas to be passed in rather than closed over.Incidental fix:
.gitignorebroke ripgrepLines 46–47 were
Icon[and]on separate lines. The canonical macOS template putsIcon[\r]on one line; split like this,Icon[is an unclosed character class and ripgrep rejects the entire ignore file:That fired on every
rginvocation in the repo. Replaced withIcon?, which still matches macOS'sIcon\r. Verified the error is gone.Verified
grep -rnE "notify\.(info|success|error|warning)\(\s*[\'"]"overfrontend/srcreturns **only a comment** — every real toast now goes throught()`.tsc --noEmit0 errors · 216 frontend tests pass ·pnpm lintpass · Prettier clean.https://claude.ai/code/session_01URDpaxhXyPLWnUQtvowNyM