Skip to content

fix(core): fall back to base language for API error messages - #9597

Merged
charIeszhao merged 2 commits into
masterfrom
charles-fix-api-error-language-fallback
Sep 14, 2026
Merged

charIeszhao merged 2 commits into
masterfrom
charles-fix-api-error-language-fallback

Conversation

@charIeszhao

Copy link
Copy Markdown
Member

Summary

Fix API error messages falling back to English when a regional language tag such as es-MX or fr-CA has a supported base language. Reuse the shared language matcher so API errors resolve to es or fr, respecting request language preferences and keeping translation instances scoped to each request.

Fixes #9594.

Testing

Unit tests

Checklist

  • .changeset
  • unit tests
  • integration tests
  • necessary TSDoc comments

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused implementation reuses established language matching behavior and is comprehensively tested.

Pull request overview

Fixes API error localization by matching regional language tags to supported base languages.

Changes:

  • Uses the shared language matcher with built-in API locales.
  • Adds regional fallback, preference-order, and request-isolation tests.
  • Adds a patch changeset.
File summaries
File Description
packages/core/src/middleware/koa-i18next.ts Resolves supported regional/base languages.
packages/core/src/middleware/koa-i18next.test.ts Expands localization middleware coverage.
.changeset/lucky-spoons-itch.md Documents the user-facing bug fix.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread .changeset/lucky-spoons-itch.md Outdated
Copilot AI review requested due to automatic review settings September 14, 2026 12:44
@github-actions github-actions Bot added size/m and removed size/m labels Sep 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused implementation matches the reported behavior and is adequately covered by unit tests.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@charIeszhao
charIeszhao enabled auto-merge (squash) September 14, 2026 12:49
@charIeszhao
charIeszhao merged commit 7d54310 into master Sep 14, 2026
42 of 45 checks passed
@charIeszhao
charIeszhao deleted the charles-fix-api-error-language-fallback branch September 14, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

bug(core): API error messages fall back to English for regional language tags instead of the base language

4 participants