Conversation
…tion v5 → v6 Breaking change in the plugin: array items in `translations[]` and `workflowStates[]` now use a dedicated `language` field for the locale identifier instead of `_key`. `_key` is now a random unique ID auto-generated by the backend. - Bump `@sanity/document-internationalization` ^5.1.0 → ^6.0.0 - Bump `sanity-plugin-internationalized-array` ^4.0.3 → ^5.0.0 - Add `language` field to workflowStates schema definition - Update all GROQ queries: `translations[_key == ...]` → `translations[language == ...]` - Update all GROQ patch operations: `[_key=="..."]` → `[language=="..."]` - Update all code reading `_key` as locale to use `language` instead - Remove `_key` from mutation payloads (auto-generated by backend) - Remove local `randomKey` utility — no longer needed - Remove legacy v5 backward-compat code (object-shape handling, `?? _key` fallbacks) - Delete `apps/translations-dashboard/src/types.ts` (use plugin's `TranslationReference`) - Regenerate TypeGen types
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…refs on publish Patch operations (append/insert) don't auto-generate _key like document creation does. Use `autoGenerateArrayKeys: true` on all `.commit()` calls. For Studio `patch.execute()` (which doesn't support the flag), use `randomKey()` from `@sanity/util/content`. Also add `_strengthenOnPublish` to translation reference creation so the Content Lake auto-strengthens weak refs once the referenced document is published (translation.metadata is liveEdit).
…types for refs
- Add LocalizedObject (KeyedObject + LANGUAGE_FIELD_NAME) as shared base type
- Use LocalizedObject for WorkflowStateEntry, TranslationMetadataEntry,
MetadataDoc, and inline fetch types in TranslationStatusContext
- Annotate createReference return types with Omit<TranslationReference, '_key'>
- Remove all inline {_key: string; language: string} patterns
kenjonespizza
approved these changes
Mar 12, 2026
Contributor
kenjonespizza
left a comment
There was a problem hiding this comment.
@nkgentile 👏 . I've not had a chance to test this, but I love the upgrade. If you've tested and feel good, Im happy for you to merge. Otherwise I can test later today
Contributor
|
Other than the suggested change, I successfully ran through and tested all testing steps! Great work Noah! |
…ta list translation.metadata has no stored `title` field (it's computed via preview.prepare), so defaultOrdering by title causes a Studio error.
kenjonespizza
approved these changes
Mar 13, 2026
Contributor
kenjonespizza
left a comment
There was a problem hiding this comment.
I committed the fix to the only bug I found. Nice work Noah!
1 task
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.
Summary
Upgrades
@sanity/document-internationalizationv5 → v6 andsanity-plugin-internationalized-arrayv4 → v5.Breaking change in the plugins: Array items in
translations[]andworkflowStates[]now use a dedicatedlanguagefield for the locale identifier instead of_key. Previously_keyheld the locale code (e.g.,"en-US"); now_keyis a random unique ID andlanguagecarries the locale code.Changes
@sanity/document-internationalization^5.1.0→^6.0.0,sanity-plugin-internationalized-array^4.0.3→^5.0.0translations[_key == ...]→translations[language == ...], addedlanguageto projectionstranslations[_key=="..."]/workflowStates[_key=="..."]→[language=="..."]t._key/entry._key→.languageeverywhere locale was read from_key_key: localeId→_key: randomKey(12), language: localeId(or omit_keywithautoGenerateArrayKeys: true).commit()calls on client transactions/patches use{autoGenerateArrayKeys: true}so_keyis auto-generated by the Content LakerandomKey(12)from@sanity/util/contentmanually (Studio document store doesn't supportautoGenerateArrayKeys)createReferencefunctions include_strengthenOnPublish: {type}so weak refs auto-strengthen when the referenced doc is publishedLocalizedObjecttype (KeyedObject & {language: string}) usingLANGUAGE_FIELD_NAMEconst from the pluginWorkflowStateEntry extends LocalizedObjectTranslationMetadataEntry extends LocalizedObjectcreateReferencereturn typed asOmit<TranslationReference, '_key'>using the plugin's type{_key: string; language: string; ...}patterns replaced withLocalizedObject & {...}languagefield toworkflowStatesarray member inmetadataFields.tsFiles changed
Packages:
packages/l10n/src/core/types.ts—LocalizedObjecttype,WorkflowStateEntryupdatedpackages/l10n/src/index.ts— exportLocalizedObjectpackages/l10n/src/translations/useTranslateActions.ts—createReference, approve/dismiss, all GROQpackages/l10n/src/translations/useTranslationPaneData.ts— GROQ queriespackages/l10n/src/translations/createTranslationPanePlugin.ts— GROQ filterpackages/l10n/src/schemas/metadataFields.ts— schema fieldpackages/l10n/src/core/staleAnalysisCache.ts—autoGenerateArrayKeyspackages/l10n/package.json—@sanity/utildependencyDashboard app:
apps/translations-dashboard/src/lib/createReference.ts—TranslationReferencetype,_strengthenOnPublishapps/translations-dashboard/src/lib/metadataOperations.ts—LocalizedObject,autoGenerateArrayKeysapps/translations-dashboard/src/lib/processDocumentTranslations.ts—autoGenerateArrayKeys,.languageapps/translations-dashboard/src/contexts/TranslationStatusContext.tsx—LocalizedObjectinline typesapps/translations-dashboard/src/hooks/useTranslationAggregateData.ts—LocalizedObjectapps/translations-dashboard/src/hooks/useCreateMissingTranslations.ts—autoGenerateArrayKeysapps/translations-dashboard/src/hooks/useRetranslateStale.ts—autoGenerateArrayKeysapps/translations-dashboard/src/hooks/useGapDocuments.ts,useStatusBreakdown.ts,useStatusFilteredDocuments.ts,useCoverageMatrix.ts,useTranslationSummary.ts,useRecentChanges.ts—.languageapps/translations-dashboard/src/queries/metadataQueries.ts— GROQ projectionsapps/translations-dashboard/src/helpers/translationStatus.ts— GROQ projectionsapps/translations-dashboard/src/components/DocumentDetail/TranslationsList.tsx—.languageFunctions:
functions/mark-translations-stale/index.ts—.languagereads and patchesfunctions/analyze-stale-translations/index.ts—.languagereads, legacy normalizeStudio:
studio/scripts/seed/briefs.ts— seed data entries uselanguagefieldTest plan
pnpm installpnpm --filter l10n typecheck && pnpm --filter translations-dashboard typecheck && pnpm --filter studio typecheckpnpm --filter studio run import-sample-datatranslation.metadatahaslanguagefield on entriesworkflowStatesentries havelanguagefield with random_key