# How do I translate a Vue app?

50.0 s · Narrator: Frederick Surrey

Install gt-vue, register its plugin with createGT before you mount the app, wrap your template in the T component, and run npx gt translate to write a catalog for each language.

| Time | Voice | Line | On screen |
| --- | --- | --- | --- |
| 0:00.88 | Narrator | In Bogotá, a reader of Spanish finds your Vue page all in English. | A page draws in the middle of the frame, with no menu and no language code over it. On "reader" its text rises: the heading "Welcome to my app" and the paragraph "This content will be translated automatically." in two lines. The heading "Your Vue page all in English" rises on "your", and on "English" the page's heading turns blue. |
| 0:05.38 | Narrator | The template is plain English, and no plugin runs before the app mounts. | On "The" the page slides to the right. On "template" a code panel opens with `src/App.vue`, a `<template>` whose `<main>` holds `<h1>Welcome to my app</h1>` and the paragraph, over `src/main.ts`, which ends `createApp(App).mount('#app');`. On "plain" the blue moves from the page to "Welcome to my app" in the `<h1>` line, and on "English" a line joins that line to the page's heading. On "plugin" the blue moves to `createApp(App).mount('#app');`, and on "mounts" a white box draws around it. |
| 0:10.54 | Narrator | General Translation lets you register the gt-vue plugin and wrap your template in T. | The answer card cuts in on "General": the answer alone rises as it is spoken, in two lines, "General Translation lets you register" then "the gt-vue plugin and wrap your template in <T>", and the General Translation mark sits small in the lower left corner. |
| 0:16.32 | Narrator | Install gt-vue, a 0.x release whose API may still change. | The heading "Install gt-vue". The code panel opens again with a terminal over the `dependencies` of `package.json`, which hold `"vue": "^3.5.43"`. On "Install" `npm install gt-vue` is typed, and on "gt-vue" `npm install --save-dev gt` on the next line. On "release" `"gt-vue": "^0.1.21",` opens in the dependencies, marked in blue. On "may" a file panel opens on the right with the project's files: `index.html`, `package.json`, and `src/` with `App.vue` and `main.ts`. On "change" a white box draws around the gt-vue line. |
| 0:22.22 | Narrator | List your languages, register the plugin before the app mounts, and wrap the template in T. | The code panel cuts to `gt.config.json`: `"defaultLocale": "en"`, `"locales": ["es", "fr", "ja"]` and the output path `src/_gt/[locale].json`, and `gt.config.json` appears in the file panel. On "languages" `"es"`, `"fr"` and `"ja"` turn blue. The heading "Register the plugin first" rises on "register", and the panel cuts to `src/main.ts`. On "plugin" `import { createGT } from 'gt-vue';` opens, then `const gt = createGT({ ... })` with `defaultLocale: 'en'` and a `loadTranslations` function that imports `./_gt/${locale}.json`. On "mounts" `createApp(App).mount('#app');` becomes `createApp(App).use(gt).mount('#app');`. On "wrap" the panel cuts to `src/App.vue`: on "template" `<T>` opens above the heading, the heading and the paragraph move in by one level, and `</T>` opens below them; on "T" a script block opens at the top with `import { T } from 'gt-vue';`. A blue bar marks each changed line. |
| 0:28.48 | Narrator | Sign in, set your project ID, and run npx gt translate. | The code panel cuts to a terminal, and on "Sign" `npx gt login` is typed. On "project" `.env.local` appears under the terminal with `GT_PROJECT_ID="your-project-id"`. The heading "Run npx gt translate" rises on "run", and on "npx" `npx gt translate` is typed on the next line. On "translate" `src/_gt/` appears in the file panel with `es.json`, `fr.json` and `ja.json` under it. |
| 0:34.02 | Narrator | Add a switcher built on useSetLocale, which loads a language without a reload. | The heading "Add a switcher built on useSetLocale", and the code panel cuts to `src/LocaleSwitcher.vue`, which reads the locale with `useLocale()` and changes it with `useSetLocale()` in `changeLocale`. On "useSetLocale" `useSetLocale` turns blue in its import and its call. On "loads" `src/App.vue` appears under it with the two lines it gains, `import LocaleSwitcher from './LocaleSwitcher.vue';` and `<LocaleSwitcher />`, which open. On "language" the page draws again on the right in place of the file panel, in English, with a language menu reading "English" above its heading, and on "reload" a white box draws around the menu. |
| 0:39.26 | Narrator | In Bogotá, the page switches in place to Japanese, French and Spanish. | The code panel and its heading drop away, and on "Bogotá" the page slides back to the middle of the frame. On "page" the box around the menu goes. On "Japanese", "French" and "Spanish" the page changes in place to that language, its menu reading each language's own name. Just after "Spanish" the Spanish heading turns blue, in the place where the English heading turned blue at the start. |
| 0:44.80 | No voice |  | The end card: the General Translation logo with generaltranslation.com/docs/vue/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.
