# Add i18n to a Tauri App

Yes. An agent adds vue-i18n to your Tauri 2 app with precompiled locale files, a language picker that follows the OS locale by default, a test, and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/add-i18n/tauri/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads how the front end is assembled before adding a plugin to it. In an app laid out like Uninen/tauri-vue-template, `package.json` runs Vue 3.5 with Pinia 3, Vite 8, Vitest 4, Tailwind 4 and `@tauri-apps/api` 2.10 under pnpm 10, and the only Tauri plugin is `@tauri-apps/plugin-shell`. `vite.config.ts` wires `unplugin-auto-import` for `vue`, `vue-router`, `pinia` and the app's own `useStore`, so components never import `ref` or `computed`, and `unplugin-vue-components` for component registration. `src/App.vue` renders a heading, three logos and `GreetComponent.vue`, which holds every user-visible string in the app: the `Enter a name...` placeholder, the `Greet` button and the greeting Pinia's `storeGreet` getter builds. `src/store.ts` keeps `name`, `version` and `debug` in one store. On the Rust side `src-tauri/src/lib.rs` registers `tauri_plugin_shell` and `tauri_plugin_prevent_default`, exposes one command, `greet`, that formats `Hello, {}! You've been greeted from Rust!`, and `src-tauri/tauri.conf.json` sets the window title to `tauri-app`. There is no `src-tauri/capabilities` directory, which works today because the app's own `greet` command needs no permission. `tests/unit/example.test.ts` asserts that one equals one, and `tests/setup/install-pinia.ts` installs a testing Pinia for every test.

The agent adds `vue-i18n` 11 and `@intlify/unplugin-vue-i18n` so the message files are compiled at build time rather than in the WebView. `src/locales/en.json` and one more locale hold the strings lifted from `GreetComponent.vue` and `App.vue` under keys such as `greet.placeholder`, `greet.button` and `greet.fromStore`; the Rust greeting is returned as a key and the name and the component formats it with `t('greet.fromRust', { name })`, since a string built in `lib.rs` cannot be translated in the WebView. `vite.config.ts` gets `VueI18nPlugin({ include: [path.resolve(__dirname, './src/locales/**')] })` and an auto-import entry for `useI18n` from `vue-i18n`, so the components keep the template's import-free style. `src/main.ts` creates the instance with `createI18n({ legacy: false, locale: 'en', fallbackLocale: 'en', messages })`, where `messages` comes from `@intlify/unplugin-vue-i18n/messages`, and installs it next to Pinia; `tsconfig.app.json` gets the plugin's `messages` type so a missing key fails `vue-tsc`.

Choosing the starting language is where the desktop app differs from a website. The agent adds `tauri-plugin-os` in `src-tauri/Cargo.toml` and `@tauri-apps/plugin-os` in `package.json`, registers `tauri_plugin_os::init()` in `lib.rs`, and creates `src-tauri/capabilities/default.json` for the `main` window with `core:default` and `os:allow-locale`, the first capability file the project has, since plugin commands are refused without one. At startup `locale()` returns a BCP-47 tag such as `en-US` or `null`; the store's `initApp()` action takes the primary subtag, falls back to `en` when it is not one of the bundled locales, and prefers a value saved in `localStorage` under `locale` when the person has picked one. A `LanguagePicker.vue` component lists the bundled locales from `i18n.global.availableLocales`, writes the choice to the global `locale` from `useI18n({ useScope: 'global' })` and to `localStorage`, and sits in `App.vue` above the greeting.

Checking uses the project's own scripts. `tests/unit/greet.test.ts` mounts `GreetComponent` with the i18n plugin and the testing Pinia from `tests/setup/install-pinia.ts`, asserts the English placeholder, switches `locale.value` and asserts the translated one, and the existing `example.test.ts` stays. The agent runs `pnpm test`, `pnpm type-check` and `pnpm build`, which is `vue-tsc --noEmit && vite build`, and `pnpm check`, the template's `cargo check --manifest-path src-tauri/Cargo.toml`, so the new plugin and capability compile; it cannot open a window in the sandbox, so it says that the picker was not clicked.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Add internationalisation to this Tauri 2 and Vue 3 app. Read package.json, vite.config.ts, vitest.config.ts, tsconfig.app.json, src/main.ts, src/App.vue, src/components/GreetComponent.vue, src/store.ts, tests/setup, tests/unit, src-tauri/Cargo.toml, src-tauri/src/lib.rs and src-tauri/tauri.conf.json first. Add vue-i18n 11 in Composition API mode with @intlify/unplugin-vue-i18n precompiling JSON files under src/locales, move every user-visible string in the Vue components into en.json plus one more locale, make the greet command return a key and the name so the component formats the greeting, auto-import useI18n, and add the plugin's messages type to tsconfig. Add the Tauri os plugin on both sides with a capabilities/default.json granting core:default and os:allow-locale, pick the starting locale from locale() with a fallback to en and a localStorage override, and add a LanguagePicker component that sets the global locale. Write a Vitest test that mounts GreetComponent with i18n and the testing Pinia and checks a string in both locales. Run pnpm test, pnpm type-check, pnpm build and pnpm check, and open a pull request that lists the keys and says the picker was not clicked in a window.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

The pull request adds `src/locales/en.json`, a second locale file, `src/i18n.ts`, `src/components/LanguagePicker.vue`, `src-tauri/capabilities/default.json` and `tests/unit/greet.test.ts`; it changes `package.json`, `pnpm-lock.yaml`, `vite.config.ts`, `tsconfig.app.json`, `src/main.ts`, `src/App.vue`, `src/components/GreetComponent.vue`, `src/store.ts`, `src-tauri/Cargo.toml`, `src-tauri/Cargo.lock` and `src-tauri/src/lib.rs`. Its description lists every key with its English text, quotes the Vitest, `vue-tsc`, `vite build` and `cargo check` output, and states that no window was opened.

A reviewer checks the second locale's wording, that the `greet` command's change keeps the Rust side free of English, and that `os:allow-locale` is the only permission the capability adds beyond `core:default`. They run `pnpm tauri dev` once to see the picker switch the heading, which is the step the sandbox could not do.

`tauri.conf.json`, the release workflow and the Tailwind setup are untouched; the window title stays in the config, since Tauri reads it before the WebView exists.

## Run it on every Linear issue labelled i18n

In the console, add an automation to the Project with this prompt and a `linear` trigger on `linear.issue.labeled`, filtered to the `i18n` label. When someone labels an issue such as "add German" or "the settings page is still English", the trigger puts the issue after the prompt and the run reads which locale or which component it names before touching the files. Only label changes by a person in your Rush org fire it, and the automation starts at most `max_runs_per_hour` runs in an hour.

An automation's runs are read-only, so the run that opens the pull request is started from your own server: a handler receiving the automation's comment sends this body to `POST /o/{org}/sessions` with the issue URL in `resources` and a `request_id` that is a UUID v5 of the issue id, so a retried delivery returns the run already started.

## Why run it on Rush?

The pieces are documented in four places: vue-i18n's Composition API, the Intlify Vite plugin, the Tauri os plugin and Tauri's capability files. Getting them to agree in one project means knowing that `legacy: false` is required for `useI18n`, that `include` must point at the locale directory or nothing is precompiled, that a plugin command is refused until a capability grants it, and that `locale()` may return `null`. The agent reads the project's own `vite.config.ts` and `lib.rs`, applies each rule where it belongs, and runs the project's four check scripts in its sandbox with the output kept.

A string moved into a JSON file is also a string that can be reviewed in one diff, which is what a translator needs; the pull request's key table is written for them as much as for the engineer.

## Frequently asked questions

### Why does the Rust command change?

`greet` in `lib.rs` formats an English sentence. Translating it there would need a locale on the Rust side and a second message catalogue. Returning the name and letting the component call `t('greet.fromRust', { name })` keeps every translation in `src/locales`, where the Vite plugin precompiles it.

### Why is a capabilities file needed now?

Tauri 2 refuses a plugin command unless a capability grants it, and the template has no `src-tauri/capabilities` directory because its only command is the app's own `greet`. Reading the OS locale through `@tauri-apps/plugin-os` is a plugin command, so `default.json` grants `os:allow-locale` to the `main` window, and nothing more.

### What happens when locale() returns null?

The store falls back to `en`, the same value `fallbackLocale` uses for a missing key. A locale the OS reports but the app does not bundle, such as `pt-BR` with only `en` and `de` present, also falls back, and the picker lets the person choose, which is then saved in `localStorage` and wins on the next start.

### Does this slow the WebView down?

The Intlify plugin compiles the JSON at build time, so the runtime does not ship the message compiler, and `vite build` with the plugin selects vue-i18n's runtime-only build in production. The locale files are part of the bundle; splitting them into lazy chunks is a follow-up the pull request mentions for when the catalogue grows.

### Can I use the SFC i18n block instead of JSON files?

Yes; the same Vite plugin compiles `<i18n>` custom blocks in a component. The agent uses JSON files under `src/locales` because a translator can edit one file per language without opening Vue components, and the `messages` virtual module merges them into the `createI18n` call.

## More Tauri jobs

- [Add Logging to a Tauri App with tauri-plugin-log](https://getrush.ai/run/add-logging/tauri/)
- [Add macOS Code Signing and Notarization to a Tauri Release Workflow](https://getrush.ai/run/add-macos-code-signing/tauri/)
- [Add a Native Menu to a Tauri App](https://getrush.ai/run/add-native-menu/tauri/)

## The same job on other stacks

- [Add i18n to a Vite React App from a Linear Issue](https://getrush.ai/run/add-i18n/vite-react/)
- [Localize a VS Code Extension](https://getrush.ai/run/add-i18n/vscode-extension/)
- [Add i18n to a Vue 3 App from a Linear Issue](https://getrush.ai/run/add-i18n/vue/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
