Skip to content

Commit

Permalink
feat: handle documents localization (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
flagrede authored Sep 24, 2024
1 parent b46ab44 commit b839c31
Show file tree
Hide file tree
Showing 5 changed files with 3,391 additions and 1,207 deletions.
4 changes: 4 additions & 0 deletions languages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const languages = [
{ id: 'es', title: 'Spanish' },
{ id: 'en', title: 'English' },
];
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
"sanity"
],
"dependencies": {
"@sanity/document-internationalization": "^3.0.1",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sanity": "^3.20.1",
"styled-components": "^5.2.0"
"sanity": "^3.57.4",
"styled-components": "^6.1.13"
},
"devDependencies": {
"@sanctucompu/sanity-graph-import": "https://github.com/regen-network/sanity-graph-import",
Expand Down
14 changes: 10 additions & 4 deletions sanity.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import { documentInternationalization } from '@sanity/document-internationalization';
import { defineConfig } from 'sanity';
import { deskTool } from 'sanity/desk';
import schemas from './schemas/schema';
import { structureTool } from 'sanity/structure';
import deskStructure from './deskStructure';
import schemas, { documentsSchemas } from './schemas/schema';
import { uniqueDocuments } from './uniqueDocuments';
import { languages } from './languages';

const config = {
projectId: process.env.SANITY_STUDIO_PROJECT_ID,
plugins: [
deskTool({
structureTool({
structure: deskStructure,
}),
documentInternationalization({
supportedLanguages: languages,
schemaTypes: documentsSchemas.map(schema => schema.name),
}),
],
schema: {
types: schemas,
Expand Down Expand Up @@ -55,5 +61,5 @@ export default defineConfig([
name: 'staging-workspace',
basePath: '/staging',
...config,
}
},
]);
Loading

0 comments on commit b839c31

Please sign in to comment.