Skip to content

fix(i18n-array): update the migration script to match v5 using langague field#761

Merged
jjburbridge merged 3 commits intomainfrom
i18n-obj-to-array-migration-v5
Apr 20, 2026
Merged

fix(i18n-array): update the migration script to match v5 using langague field#761
jjburbridge merged 3 commits intomainfrom
i18n-obj-to-array-migration-v5

Conversation

@jjburbridge
Copy link
Copy Markdown
Contributor

Description

Tweak to migration script from objects to array to use the dedicated language field rather than key. This keeps the migration script up to date with the current implementation of the plugin

What to review

Confirm that migration output matches the new v5 version

Testing

I tested the migration on a object of:

intTitle: {
  en: "Title",
  fr: "fr title",
  es: "es title",
  de: "de title",
  it: "it title",
}

and it converted it to:

intTitle: [
    {
      "_key": "4a14d51e9150454c32ff7a9e52e4616f",
      "language": "en",
      "value": "Title"
    },
    {
      "_key": "4a367f77795b178f10664c135aeb75ff",
      "language": "fr",
      "value": "fr Title"
    },
    {
      "_key": "acf6d2fd95e231dec3d450a60427cd45",
      "_type": "internationalizedArrayStringValue",
      "language": "es title"
    },
    {
      "_key": "d1bc5e6c3cb7450a3fb597f1cc211ef1",
      "language": "de",
      "value": "de Title"
    },
    {
      "_key": "fbd9a982777c6a3a28b91061608ebfc8",
      "language": "it",
      "value": "it Title"
    }
]

and this displayed correctly in a studio with the v5 plugin

Copilot AI review requested due to automatic review settings March 19, 2026 10:51
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 19, 2026

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

Project Deployment Actions Updated (UTC)
plugins-studio Ready Ready Preview, Comment Mar 19, 2026 11:02am

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 19, 2026

🦋 Changeset detected

Latest commit: 7c3fdff

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

This PR includes changesets to release 2 packages
Name Type
sanity-plugin-internationalized-array Patch
@sanity/document-internationalization 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

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

Updates the object-to-array migration example for sanity-plugin-internationalized-array to align with the v5 data model where the language identifier is stored in a dedicated language field (instead of using _key as the language).

Changes:

  • Generate a random _key for each migrated array item.
  • Store the original object key (language id) in a new language field.
  • Update the inline example in the script comments to reflect the new output shape.

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

Copy link
Copy Markdown
Contributor

@juice49 juice49 left a comment

Choose a reason for hiding this comment

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

Thanks, Jon! Looks good to me.

@jjburbridge jjburbridge merged commit 8dce14f into main Apr 20, 2026
10 checks passed
@jjburbridge jjburbridge deleted the i18n-obj-to-array-migration-v5 branch April 20, 2026 09:24
@squiggler-app squiggler-app Bot mentioned this pull request Apr 20, 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