feat(plugins): add locale to ContentItem#539
Merged
ascorbic merged 1 commit intoemdash-cms:mainfrom Apr 13, 2026
Merged
Conversation
Exposes `locale` on the plugin-facing ContentItem type, mirroring the pattern used for slug/status/publishedAt in emdash-cms#536. The internal content repository entity already carries locale — this PR plumbs it through the public API so plugins that build i18n URLs from content records can pick the correct URL prefix instead of falling back to the default locale (which produces wrong URLs on multilingual sites). Follow-up to emdash-cms#536 / Discussion emdash-cms#530. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: ff33c88 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 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 |
7 tasks
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/blocks
@emdash-cms/cloudflare
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands the plugin-facing content access API by adding locale to the ContentItem type, plumbing through an already-existing database column so plugins can generate correct i18n-aware URLs and related artifacts.
Changes:
- Add
locale: string | nullto the exported pluginContentItemtype. - Include
localein the runtime objects returned byctx.content.get(),ctx.content.list(),ctx.content.create(), andctx.content.update(). - Add a Changeset bumping
emdashas a minor release for the additive public API expansion.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/core/src/plugins/types.ts | Extends the plugin API surface (ContentItem) with the locale field. |
| packages/core/src/plugins/context.ts | Adds locale to the mapped objects returned by plugin content access methods (read + write). |
| .changeset/content-item-locale.md | Declares a minor version bump and documents the plugin-facing API addition. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merged
fmhall
pushed a commit
to fmhall/emdash
that referenced
this pull request
Apr 13, 2026
Exposes `locale` on the plugin-facing ContentItem type, mirroring the pattern used for slug/status/publishedAt in emdash-cms#536. The internal content repository entity already carries locale — this PR plumbs it through the public API so plugins that build i18n URLs from content records can pick the correct URL prefix instead of falling back to the default locale (which produces wrong URLs on multilingual sites). Follow-up to emdash-cms#536 / Discussion emdash-cms#530. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
What does this PR do?
Adds
localeto the plugin-facingContentItemtype. Follow-up to #536, which addedslug/status/publishedAtbut leftlocaleout.Why: plugins that build i18n URLs from content records (sitemaps, llms.txt, schema maps, alternate-language link graphs, etc.) need the locale to pick the correct URL prefix. Without it they fall back to the default locale and emit wrong URLs on multilingual sites — the failure is silent on single-locale sites (the locale always equals the default) and only surfaces when someone enables i18n.
The internal
ContentRepositoryentity already carrieslocale(it's a real column on everyec_*table). This PR just plumbs it through the public API, matching the pattern #536 established for the other system fields.Discussion: #530 — maintainer explicitly invited PRs in a comment on that thread.
Type of change
ContentItem— purely expanding the returned shape, no behavior change for existing consumers)Checklist
pnpm typecheckpasses (core)pnpm formatrunemdashminor)AI-generated code disclosure
Sibling PR coming for
ContentListOptions.where.status— the second piece of #530 that #536 didn't cover. Keeping it separate since it's a query-API change rather than a shape expansion.