Tips for localizing the rich text editor in Sanity.io using a custom localeBlock type.
Good news! You're on the right track. The guide you're using is a solid foundation, but you're correct that localizing Portable Text (block content) needs special consideration.
The short answer: For rich text editors (Portable Text/block arrays), you should use document-level localization rather than field-level localization. This means creating separate documents for each language version instead of trying to nest translations within the same document.
Here's why this matters: Field-level localization with Portable Text can quickly hit Sanity's attribute limits because block arrays create numerous unique paths in your data structure. When you multiply that by multiple languages in the same document, you can run into serious issues.
How to implement document-level localization for block content:
Use the official plugin: Install @sanity/document-internationalization which is specifically designed for this approach. It handles creating and linking translated documents.
Structure your schema normally: Your block content field stays as a regular
type: 'array'of blocks - no special wrapping needed:
{
name: 'content',
type: 'array',
of: [{type: 'block'}]
}Add language metadata: Each document gets a
languagefield, and the plugin manages the relationships between language versions automatically.Query by language: When fetching content, filter by language:
*[_type == "post" && language == "fr"]The beauty of this approach is that your rich text editor works exactly the same way in all languages - you're just editing different documents. Each language version is independent, which also means translators can work without affecting other languages, and you can publish them on different schedules.
If you need fields that are shared across all language versions (like image galleries), you can maintain those in the base language document and reference them from translations.
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.