Write extraction only to the source locale - #36
Conversation
🦋 Changeset detectedLatest commit: 299fc6c The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 48 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughExtraction now writes only source-locale catalogues, missing locales are bootstrapped, and ChangesLocale catalogue flow
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant ExtractCommand
participant BucketExtractWorker
participant LocaleFiles
participant CleanCommand
ExtractCommand->>BucketExtractWorker: extract messages
BucketExtractWorker->>LocaleFiles: write source locale
BucketExtractWorker->>LocaleFiles: create missing placeholders
CleanCommand->>LocaleFiles: reconcile non-source locales
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/config/src/features/catalogue/record.ts (1)
42-47: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winPrefer nullish coalescing operator for optional string fields.
If
message.translationis explicitly set to an empty string (e.g. legitimately translated as empty), using the logical OR (||) operator will incorrectly fall back tomessage.message. Using the nullish coalescing operator (??) ensures that onlynullorundefinedwill trigger the fallback, preserving intentional empty strings.♻️ Proposed refactor
for (const content of [...contents].reverse()) { if (!content) continue; for (const message of bucket.formatter.parse(content)) { - const key = message.id || generateHash(message.message, message.context); - record[key] = message.translation || message.message; + const key = message.id ?? generateHash(message.message, message.context); + record[key] = message.translation ?? message.message; } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/config/src/features/catalogue/record.ts` around lines 42 - 47, Update the assignment in the record-building loop to use nullish coalescing for message.translation, so empty-string translations are preserved and only null or undefined values fall back to message.message.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/config/src/features/catalogue/record.ts`:
- Around line 42-47: Update the assignment in the record-building loop to use
nullish coalescing for message.translation, so empty-string translations are
preserved and only null or undefined values fall back to message.message.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 41d9ebc0-1c96-44d3-887e-79ebdd088356
📒 Files selected for processing (27)
README.mdpackages/config/README.mdpackages/config/package.jsonpackages/config/src/commands/clean.tspackages/config/src/commands/index.tspackages/config/src/features/catalogue/index.tspackages/config/src/features/catalogue/merge.test.tspackages/config/src/features/catalogue/merge.tspackages/config/src/features/catalogue/record.test.tspackages/config/src/features/catalogue/record.tspackages/config/src/features/workers/extract-worker.test.tspackages/config/src/features/workers/extract-worker.tspackages/config/src/shapes.tspackages/config/tsdown.config.tspackages/plugin-babel/src/index.test.tspackages/plugin-babel/src/index.tspackages/plugin-unplugin/src/index.test.tspackages/plugin-unplugin/src/index.tswebsite/content/core-concepts/architecture.mdxwebsite/content/core-concepts/configuration.mdxwebsite/content/core-concepts/extraction.mdxwebsite/content/core-concepts/messages.mdxwebsite/content/getting-started/quickstart.mdxwebsite/content/integrations/babel.mdxwebsite/content/integrations/vite.mdxwebsite/content/reference/api/config.mdxwebsite/content/reference/cli.mdx
Closes #34
Summary by CodeRabbit
New Features
saykit cleancommand to reconcile non-source locale files while preserving existing translations.Documentation