# How do I translate a TanStack Start app?

51.1 s · Narrator: Frederick Surrey

Install the experimental gt-tanstack-start package with gt-react and the gt CLI, list your languages in gt.config.json, call initializeGT in the router with them and a loadTranslations file, register gtMiddleware in src/start.ts so each request resolves its locale, pass the locale and its translations from the root route's loader to GTProvider, wrap your content in the T component, and run npx gt translate.

| Time | Voice | Line | On screen |
| --- | --- | --- | --- |
| 0:00.88 | Narrator | In Kyoto, a Japanese browser gets your TanStack Start page in English. | An app page draws in the middle of the frame. On "Japanese" the language code `ja` appears over its top right corner: the language the reader's browser asks for. On "browser" the heading "Welcome to my app" and the line "This content is translated automatically." rise, and the heading "Your TanStack Start page in English" rises on "your". On "English" the page's heading turns blue. |
| 0:06.00 | Narrator | The server renders this English JSX for every request, and nothing reads its language. | On "The" the page slides to the right, and on "server" a code panel opens with `src/routes/index.tsx`: a `Home` function whose `<main>` holds `<h1>Welcome to my app</h1>` and the paragraph. On "English" the blue moves from the page to `Welcome to my app` in the code, on "every" a line joins that row to the page's heading, and on "nothing" a white box draws around the whole function. |
| 0:13.32 | Narrator | General Translation lets you translate a TanStack Start app with gt-tanstack-start. | The answer card cuts in on "General": the answer alone rises as it is spoken, in two lines, "General Translation lets you translate" then "a TanStack Start app with gt-tanstack-start", and the General Translation mark sits small in the lower left corner. |
| 0:19.46 | Narrator | Install the experimental gt-tanstack-start package, and call initializeGT with your languages and a loader. | The heading "Install the experimental gt-tanstack-start", and the code panel opens again on a terminal. On "Install" `npm install gt-tanstack-start gt-react` is typed, then `npm install gt --save-dev` on the next line. On "package" a file panel opens on the right with the project's files. On "call" the code panel cuts to `src/router.tsx`, and on "initializeGT" the line `initializeGT({ ...gtConfig, loadTranslations });` turns blue. On "languages" `gt.config.json` appears under it with the locales `"es"` and `"ja"` in blue, and joins the files. On "loader" `loadTranslations` turns blue, and `loadTranslations.ts` joins the files. |
| 0:27.54 | Narrator | Register gtMiddleware to read each request's language, and pass it from the root route to GTProvider. | The heading "Register gtMiddleware", and the code panel cuts to `src/start.ts`, whose `createStart` lists `requestMiddleware: [csrfMiddleware, gtMiddleware]`. On "gtMiddleware" its name turns blue and `start.ts` joins the files, and on "request's" a white box draws around the `requestMiddleware` line. On "pass" the panel cuts to the root route in `src/routes/__root.tsx`, and on "root" a `loader` opens in it that returns the request's `locale` from `getLocale()` and its translations from `getTranslationsSnapshot(locale)`, a blue bar beside each new line. On "GTProvider" a white box draws around what the loader returns. |
| 0:34.90 | Narrator | Wrap the page in T, sign in, and run npx gt translate. | The heading "Wrap the page in <T>", and the code panel cuts to `src/routes/index.tsx`. On "page" `<T>` and `</T>` open around the heading and the paragraph, which move in, a blue bar beside each changed line. On "sign" the panel cuts to a terminal where `npx gt login` is typed, and on "run" `GT_PROJECT_ID=your-project-id npx gt translate` is typed on the next line. On "translate" `_gt/` appears in the file panel under `src/`, with `es.json` and `ja.json`. |
| 0:40.46 | Narrator | Now a Spanish browser gets the page in Spanish, and the one in Kyoto gets Japanese. | The app page cuts back in the middle of the frame for a Spanish browser: the language code `es`, and the page in Spanish. On the second "Spanish" a white box draws around its heading, and on "Kyoto" the box goes. On "Japanese" the page cuts to the Japanese browser's: the code `ja` and the page in Japanese, and its heading turns blue, in the place where the English heading turned blue at the start. |
| 0:45.90 | No voice |  | The end card: the General Translation logo with generaltranslation.com/docs/react/tanstack-start-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.
