Skip to content

feat(plugins): add locale to ContentItem#539

Merged
ascorbic merged 1 commit intoemdash-cms:mainfrom
jdevalk:feat/content-item-locale
Apr 13, 2026
Merged

feat(plugins): add locale to ContentItem#539
ascorbic merged 1 commit intoemdash-cms:mainfrom
jdevalk:feat/content-item-locale

Conversation

@jdevalk
Copy link
Copy Markdown
Contributor

@jdevalk jdevalk commented Apr 13, 2026

What does this PR do?

Adds locale to the plugin-facing ContentItem type. Follow-up to #536, which added slug/status/publishedAt but left locale out.

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 ContentRepository entity already carries locale (it's a real column on every ec_* 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

  • Feature (additive to ContentItem — purely expanding the returned shape, no behavior change for existing consumers)

Checklist

AI-generated code disclosure

  • This PR includes AI-generated code

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.

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>
Copilot AI review requested due to automatic review settings April 13, 2026 20:04
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 13, 2026

🦋 Changeset detected

Latest commit: ff33c88

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
emdash Minor
@emdash-cms/cloudflare Minor
@emdash-cms/admin Minor
@emdash-cms/auth Minor
@emdash-cms/blocks Minor
@emdash-cms/gutenberg-to-portable-text Minor
@emdash-cms/x402 Minor
create-emdash Minor
@emdash-cms/plugin-embeds Patch

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 13, 2026

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@539

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@539

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@539

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@539

emdash

npm i https://pkg.pr.new/emdash@539

create-emdash

npm i https://pkg.pr.new/create-emdash@539

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@539

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@539

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@539

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@539

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@539

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@539

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@539

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@539

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@539

commit: ff33c88

Copy link
Copy Markdown
Contributor

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

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 | null to the exported plugin ContentItem type.
  • Include locale in the runtime objects returned by ctx.content.get(), ctx.content.list(), ctx.content.create(), and ctx.content.update().
  • Add a Changeset bumping emdash as 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.

Copy link
Copy Markdown
Collaborator

@ascorbic ascorbic left a comment

Choose a reason for hiding this comment

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

Thanks

@ascorbic ascorbic enabled auto-merge (squash) April 13, 2026 20:09
@ascorbic ascorbic merged commit 8ed7969 into emdash-cms:main Apr 13, 2026
28 of 30 checks passed
@jdevalk jdevalk deleted the feat/content-item-locale branch April 13, 2026 20:12
@emdashbot emdashbot bot mentioned this pull request Apr 13, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants