Skip to content

feat(i18n-doc): add support for disabling automatic template creation via addTemplates #780

Merged
pedrobonamin merged 1 commit intosanity-io:mainfrom
Jamiewarb:make-templates-optional
Apr 8, 2026
Merged

feat(i18n-doc): add support for disabling automatic template creation via addTemplates #780
pedrobonamin merged 1 commit intosanity-io:mainfrom
Jamiewarb:make-templates-optional

Conversation

@Jamiewarb
Copy link
Copy Markdown
Contributor

Description

This PR adds support for disabling automatic template creation via the addTemplates config option

This allows future-proofed disabling of the templates when a user manages them within their own codebase, without needing to looking up template IDs to un-register them, and without needing to check if they've changed each time they update the plugin

By default addTemplates is true to maintain backwards compatibility

What to review

Add addTemplates: false to the i18n-doc plugin config in the test studio.

You'll then be able to see your templates are no longer being added, e.g. via the New Document global menu

Testing

There aren't tests for what what the plugin config outputs currently. However I conducted manual testing to ensure the templates weren't created when addTemplates was false

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 24, 2026

@Jamiewarb is attempting to deploy a commit to the Sanity Sandbox Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 24, 2026

🦋 Changeset detected

Latest commit: 40ede22

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

This PR includes changesets to release 1 package
Name Type
@sanity/document-internationalization Minor

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

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
plugins-studio Ready Ready Preview, Comment Apr 8, 2026 0:31am

Request Review

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

Adds a new plugin configuration option to disable automatic initial value template creation in @sanity/document-internationalization, preserving current behavior by default.

Changes:

  • Introduces addTemplates?: boolean on the plugin config surface.
  • Gates schema template generation behind the addTemplates option.
  • Sets addTemplates: true in the plugin default config and adds a changeset for a minor release.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
plugins/@sanity/document-internationalization/src/types.ts Adds the addTemplates config option to the public PluginConfig type.
plugins/@sanity/document-internationalization/src/plugin.tsx Skips adding templates when addTemplates is disabled.
plugins/@sanity/document-internationalization/src/constants.ts Defaults addTemplates to true for backward compatibility.
.changeset/odd-mangos-knock.md Declares a minor version bump and documents the new option.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@pedrobonamin pedrobonamin left a comment

Choose a reason for hiding this comment

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

Thank you for this @Jamiewarb !
The change looks good to me, merging it now and doing a release.

@pedrobonamin pedrobonamin enabled auto-merge (squash) April 8, 2026 12:39
@pedrobonamin pedrobonamin merged commit c6463af into sanity-io:main Apr 8, 2026
14 checks passed
@squiggler-app squiggler-app bot mentioned this pull request Apr 8, 2026
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