i am currently trying to create a new dataset for each localized language , ie. spanish, russian. how can i get a studio to work on diff dataset?
You can configure your Sanity Studio to work with multiple datasets using workspaces! This is exactly what you need for managing different language-specific datasets.
Workspaces allow you to have multiple isolated Studio configurations within a single codebase, where each workspace can connect to a different dataset. Here's how to set it up:
Basic Configuration
In your sanity.config.ts (or .js), define multiple workspaces instead of a single configuration:
import {defineConfig} from 'sanity'
import {structureTool} from 'sanity/structure'
import {schemaTypes} from './schemas'
export default defineConfig([
{
name: 'english',
title: 'English (Production)',
projectId: 'your-project-id',
dataset: 'production', // your current English dataset
plugins: [structureTool()],
schema: {
types: schemaTypes,
},
basePath: '/english',
},
{
name: 'spanish',
title: 'Spanish',
projectId: 'your-project-id',
dataset: 'spanish', // your Spanish dataset
plugins: [structureTool()],
schema: {
types: schemaTypes,
},
basePath: '/spanish',
},
{
name: 'russian',
title: 'Russian',
projectId: 'your-project-id',
dataset: 'russian', // your Russian dataset
plugins: [structureTool()],
schema: {
types: schemaTypes,
},
basePath: '/russian',
},
])What This Does
- Creates a workspace switcher in your Studio (top left corner) where you can toggle between English, Spanish, and Russian
- Each workspace connects to its own dataset
- All workspaces share the same schema and codebase
- The
basePathcreates unique URLs like/english,/spanish,/russian
Deployment
When you run sanity deploy, it deploys all workspaces to your hosted Studio. Users can then switch between them using the dropdown menu.
Important Notes
Create the datasets first: Make sure you've created the
spanishandrussiandatasets in your project (you can do this via the Sanity CLI withsanity dataset create spanish)Shared schema: All datasets will use the same schema definition. If you need different schemas per language, you'll need to implement conditional logic in your schema configuration based on the active workspace.
Access control: You can configure different permissions per workspace if needed through your project's access settings.
This approach is much cleaner than managing separate Studio deployments and gives your content editors a seamless way to switch between language-specific content!
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.