# How do I translate content in Sanity?

48.8 s · Narrator: Frederick Surrey

Install the gt-sanity plugin, add gtPlugin to sanity.config.ts with your locales and document types, and click Translate on a document. Each translation is imported as a draft document with a language field that you can publish and query.

| Time | Voice | Line | On screen |
| --- | --- | --- | --- |
| 0:00.90 | Narrator | In Buenos Aires, your site shows its spring product update only in English. | A browser draws in the middle of the frame, its tab and address drawn as bars. On "Buenos" the language code `es` appears over its top right corner: the browser asks for Spanish. On "site" the site's page rises: its name as a bar, the article's title "Spring product update" and its copy as bars. The heading "Spring product update only in English" rises on "spring", and on "English" the title turns blue. |
| 0:05.90 | Narrator | Sanity stores the article as one English document with no language field. | On "Sanity" the browser slides to the right. On "stores" a panel opens with the Studio's document list for "Article": one row, "Spring product update", with no language code beside it. On "document" the blue moves from the title to that row, and on "with" a line joins the row to the title in the browser. On "field" a white box draws around the row. |
| 0:11.18 | Narrator | General Translation lets you click Translate on a Sanity document with the gt-sanity plugin. | The answer card cuts in on "General": the answer alone rises as it is spoken, in two lines, "General Translation lets you click Translate" then "on a Sanity document with the gt-sanity plugin", and the General Translation mark sits small in the lower left corner. |
| 0:17.12 | Narrator | Add gtPlugin to sanity.config.ts with your locales and document types. | The panel opens again on a terminal where `npm install gt-sanity` has run. The heading "Add gtPlugin to sanity.config.ts" rises on "Add". On "to" the panel cuts to `sanity.config.ts`, a Studio config whose plugins list holds `structureTool()`. On "config" `import { gtPlugin } from 'gt-sanity';` opens under the imports, and the plugins list opens out to hold `structureTool()` and `gtPlugin({ })`. On "with" a file panel opens on the right with `package.json`, `sanity.config.ts`, and `schema/` with `article.ts`. On "locales" `sourceLocale: 'en',` and `locales: ['es', 'zh', 'ja'],` open inside `gtPlugin`, and on "document" `translateDocuments: [{ type: 'article' }],`. A blue bar marks each changed line. |
| 0:23.88 | Narrator | Give the article a language field, and store your API key in a private document. | The heading "Give the article a language field", and the panel cuts to `schema/article.ts`, the article type's `defineType` with its fields. On "language" a `defineField` for a field named `language` opens a line at a time: `type: 'string'`, `readOnly: true`, `hidden: true`. On "your" the panel cuts to `populateSecrets.js`, where `client.createOrReplace` writes a document with `_id: 'generaltranslation.secrets'`, `secret: process.env.GT_API_KEY` and `project: process.env.GT_PROJECT_ID`, and the file appears in the file panel. On "key" `GT_API_KEY` and `GT_PROJECT_ID` turn blue, and on "private" a white box draws around the `_id` line. |
| 0:29.08 | Narrator | Click Translate on the article, and the plugin imports each translation as a draft. | The heading "Click Translate on the article", and the panel cuts to the Studio's editor for "Spring product update": its Title field, its Body, and an action bar with Publish and Translate. On "Translate" a white box draws around Translate. On "article" the Translations dialog opens on the right in place of the file panel, with Spanish, Chinese and Japanese checked under "Select locales", a Translate button, and a "Translation Status" list where each language reads "Not translated", and a line draws from the editor's Translate to the dialog. On "plugin" the dialog's Translate is pressed. On "imports" the dialog's Translate and each status read "Translating…", and on "draft" each status reads "Imported" and the button "Translate" again. |
| 0:34.80 | Narrator | Publish the drafts, then query each language by its language field. | The heading "Publish the drafts" rises, and on "Publish" the dialog's Publish Translations is pressed. On "drafts" the panel cuts to the Studio's document list, where the three translations rise under "Spring product update", each with its language code, `es`, `zh` and `ja`. On "query" the panel cuts to a GROQ query, `*[_type == "article" && language == "es"]{ title, slug, body }`. On "language" `language == "es"` turns blue, and on "field" a white box draws around the query. |
| 0:39.14 | Narrator | Chinese, Japanese and Spanish readers now each get their own article. | The browser cuts back in the middle of the frame, showing the page a reader of Chinese gets, with the code `zh` and the title in Chinese. On "Japanese" it cuts to the page a reader of Japanese gets, with `ja`, and on "Spanish" to the page the reader of Spanish gets, with `es` and the title in Spanish in two lines. On "now" the title turns blue, in the place where the English title turned blue at the start, and on "article" a white box draws around it. |
| 0:43.55 | No voice |  | The end card: the General Translation logo with generaltranslation.com/docs/integrations/sanity/quickstart under it, held to the last frame while the music ends on a held chord. |

Times are where each line starts in the final, read from the film's own audio.
