Skip to content

🐛 Fixed translations for Inbox Links button#26839

Merged
9larsons merged 1 commit intomainfrom
properly-translate-inbox-link-button
Mar 17, 2026
Merged

🐛 Fixed translations for Inbox Links button#26839
9larsons merged 1 commit intomainfrom
properly-translate-inbox-link-button

Conversation

@EvanHahn
Copy link
Contributor

@EvanHahn EvanHahn commented Mar 16, 2026

closes https://linear.app/ghost/issue/ONC-1548
ref #26308

Before After
Before After

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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2a1beda0-ad8a-49e9-8c74-9c88901237cb

📥 Commits

Reviewing files that changed from the base of the PR and between bea537d and 18bf7b4.

📒 Files selected for processing (2)
  • apps/portal/package.json
  • apps/portal/src/components/common/inbox-link-button.js

Walkthrough

The Portal package version was bumped from 2.66.3 to 2.66.4. The inbox link button component was refactored: a new Provider type was introduced, the static PROVIDER_LABELS lookup was replaced by a getProviderLabel(provider) switch-based function with a default fallback, JSDoc was updated to reference Provider, and label rendering now calls getProviderLabel. Icon rendering logic was unchanged.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing translations for the Inbox Links button, which aligns with the core fix of computing button text after language changes.
Description check ✅ Passed The description is directly related to the changeset, explaining the root cause (text computed before language change) and the fix (compute at runtime).
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch properly-translate-inbox-link-button
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.
@EvanHahn EvanHahn force-pushed the properly-translate-inbox-link-button branch from 11857d5 to 18bf7b4 Compare March 16, 2026 22:24
@EvanHahn

This comment was marked as outdated.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 16, 2026

✅ Actions performed

Full review triggered.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between bea537d and 18bf7b4.

📒 Files selected for processing (2)
  • apps/portal/package.json
  • apps/portal/src/components/common/inbox-link-button.js

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 after i18n.changeLanguage(...).
  • Add a Provider JSDoc typedef and reuse it in component prop docs.
  • Bump @tryghost/portal version from 2.66.32.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.

Comment on lines +51 to +55
const getProviderLabel = (provider) => {
switch (provider) {
case 'gmail':
return t('Open Gmail');
case 'outlook':
Copy link
Contributor

@9larsons 9larsons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch 👍.

@9larsons 9larsons merged commit 9dbd94c into main Mar 17, 2026
32 checks passed
@9larsons 9larsons deleted the properly-translate-inbox-link-button branch March 17, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants