🐛 Fixed translations for Inbox Links button#26839
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThe Portal package version was bumped from 2.66.3 to 2.66.4. The inbox link button component was refactored: a new 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
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 |
closes https://linear.app/ghost/issue/ONC-1548 We always showed English text on the Inbox Links button. Now we translate it properly. This happened because we computed the text before changing the language and never updated it. Now we compute it at the last minute, which fixes the problem.
11857d5 to
18bf7b4
Compare
This comment was marked as outdated.
This comment was marked as outdated.
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/portal/src/components/common/inbox-link-button.js`:
- Around line 51-75: The dev-mailpit case in getProviderLabel returns a
hardcoded English string; change that branch to call the translation function
like the other cases (use t('Open Mailpit (development only)')) so the Mailpit
label is localized; locate the getProviderLabel function and update the
'dev-mailpit' case to return t(...) instead of a plain string.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a82d78a1-b14a-4d3f-8441-126e31825d84
📒 Files selected for processing (2)
apps/portal/package.jsonapps/portal/src/components/common/inbox-link-button.js
There was a problem hiding this comment.
Pull request overview
Fixes a Portal i18n timing issue where the “Inbox Links” button label was computed before the app switched languages, causing it to remain in English even when Portal renders in a different locale.
Changes:
- Replace module-initialized provider label map with a runtime
getProviderLabel()lookup so translations are evaluated afteri18n.changeLanguage(...). - Add a
ProviderJSDoc typedef and reuse it in component prop docs. - Bump
@tryghost/portalversion from2.66.3→2.66.4.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/portal/src/components/common/inbox-link-button.js | Lazily computes provider button labels via t() at render-time to reflect the active language. |
| apps/portal/package.json | Patch version bump for Portal release. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| const getProviderLabel = (provider) => { | ||
| switch (provider) { | ||
| case 'gmail': | ||
| return t('Open Gmail'); | ||
| case 'outlook': |
closes https://linear.app/ghost/issue/ONC-1548
ref #26308
We always showed English text on the Inbox Links button. Now we translate it properly.
This happened because we computed the text before changing the language and never updated it. Now we compute it at the last minute, which fixes the problem.