All jobs

Add i18n to a SvelteKit App from a Linear Issue

Yes. An agent reads the Linear issue, adds a translation layer to your SvelteKit app, moves its hard-coded strings into message files and opens a pull request.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The agent starts from the issue and the repository in its own cloud sandbox and takes stock of the strings before it adds a library. In an app like sveltejs/realworld (@sveltejs/kit ^2.52.2, Svelte ^5.55.7 with runes: true in svelte.config.js, Vite ^7.3.2, adapter-vercel, pnpm@10.20.0 from packageManager, JavaScript with a jsconfig.json), the text lives inline in the components: "Home", "New Post", "Settings" and "Sign in" in src/routes/Nav.svelte; "A place to share your knowledge.", "Global Feed", "Your Feed" and "Sign in to see your Feed" in src/routes/+page.svelte; "Sign In", "Need an account?" and the Email placeholder in src/routes/login/+page.svelte; "Your Settings" and "URL of profile picture" in src/routes/settings/+page.svelte; the not-found and "Something went wrong" headings in src/routes/+error.svelte; and page titles such as "Sign in • Conduit" in each <svelte:head>. The agent greps for every such string and lists them in its plan with the file each comes from.

Then it reads how requests flow, because locale detection has to sit in the same place as authentication. src/hooks.server.js exports a handle that reads the jwt cookie into event.locals.user; src/routes/+layout.server.js passes user down; src/routes/+layout.svelte renders Nav and the page. src/lib/api.js talks to the RealWorld API, whose article content is user data and is not translated. The plan: add Paraglide, the compile-time i18n library the SvelteKit CLI offers as an add-on, keep the API layer untouched, and translate only the interface strings.

The change lands in the files that own it. project.inlang/settings.json declares the base locale and the locales the issue names, messages/en.json holds every string from the inventory under keys like nav_home and login_title, and one file per added locale holds the translations the issue supplies, with the English text left in place and marked for any key the issue does not cover. vite.config.js gains the Paraglide plugin beside sveltekit(), src/hooks.server.js wraps the existing handle with Paraglide's middleware through sequence, so event.locals.user keeps working, a src/hooks.js adds the locale-aware reroute, and src/app.html gets the lang attribute Paraglide sets. Each component imports the generated messages and swaps its literal for a call, including the <svelte:head> titles, and Nav.svelte gets a small locale switch.

The repository has no test script, so the proof is the build and the rendered pages. The agent runs pnpm install with the frozen lockfile, pnpm build, and pnpm lint, which runs prettier --check . with prettier-plugin-svelte, fixing format with pnpm format. Then it starts pnpm preview and fetches the home, login and settings pages with each locale, in its own browser and with curl and an Accept-Language header, confirming the strings change and the lang attribute follows, and that a signed-in request still shows the user's menu. Only then does it push the branch.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "A Linear issue labeled agent says: \"Add internationalisation. Make English the base locale, add the locales listed in this issue with the translations attached, let a visitor switch locale, and keep article content as it comes from the API.\" Before changing anything, inventory every user-facing string in src/routes and src/lib, including svelte:head titles and input placeholders, with the file each comes from, and read hooks.server.js, the layout files and vite.config.js. Add Paraglide: the inlang project settings, a messages file per locale with every inventoried string under a stable key, the Vite plugin, server-hook middleware composed with the existing handle so authentication keeps working, the reroute hook, and the lang attribute in app.html. Replace each literal with its message call, add a locale switch to the navigation, and leave the API client untouched. Run the build and the lint script until they pass, start the preview server and check the home, login and settings pages in each locale, then open a pull request that links back to the issue and lists every string moved.",
  "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

What comes back is a pull request on its own branch whose description starts with the string inventory: each literal, the file it came from and the message key it became. The diff adds project.inlang/settings.json, messages/<locale>.json, the Vite plugin line, the composed handle in src/hooks.server.js, src/hooks.js, the lang attribute in src/app.html, the message calls in each component, and the locale switch in Nav.svelte. src/lib/api.js is unchanged.

The transcript carries the proof: the pnpm build and pnpm lint runs with their output, including any that failed before a fix, and the preview-server fetches showing the home, login and settings pages in each locale with the right lang attribute. If the repository deploys previews from pull requests, the reviewer can click through the same pages there.

Before merging, a reviewer checks that no interface string was missed (the inventory makes this a diff against the list), that the locale switch keeps the current page and query, that server-rendered and client-navigated pages agree on the locale, and that the translations the issue supplied landed under the right keys.

Run it on every Linear issue labelled agent

In the console, an automation with a linear trigger on linear.issue.labeled and the label agent starts one run per labelled issue in the Project's repository. The trigger adds the issue's text after the saved prompt, so the locales and the translations come from the issue while the prompt stays fixed. Changes made by an app integration never fire it, and the automation's max_runs_per_hour bounds how many runs a burst of labelling can start.

From your own server, the same job is one POST /o/{org}/sessions per issue, with the repository in resources and the issue's https://linear.app/<workspace>/issue/<ID> URL beside it so Rush reads the issue through your Linear connection. A webhook_url on the API key receives run.completed or run.failed for every run that key starts, with the session_url to read the pull request link from.

The use case this job follows, with its automation and trigger: Turn a Linear label into a PR.

Why run it on Rush?

An i18n change is wide and shallow: a dozen files, a string moved in each, a hook composed with another hook, and the only way to know nothing broke is to build and look at every page in every locale. In a Rush sandbox the agent runs the production build, the formatter check and the preview server, and reads each page back with its own browser, so the pull request arrives with that walk-through already done and recorded.

A label in Linear becomes a reviewable pull request whose reasoning is on the record: the transcript shows the string inventory before any edit, the build runs with their output, and the pages fetched per locale. Several labelled issues can run at once, each in its own sandbox on its own branch, and each pull request links back to the issue that asked for it.

Frequently asked questions

Why Paraglide rather than another i18n library?

It is the add-on the SvelteKit CLI offers for i18n, it compiles messages to plain functions so the bundle only carries the locales used, and it ships SvelteKit hooks for locale detection and rerouting. If the issue names another library, the agent uses that instead and the pull request says so.

Will article text and comments be translated?

No. Those come from the API as user content, and src/lib/api.js is left untouched. Only interface strings, titles and placeholders move into the message files.

What if I only have English translations for some strings?

Every key exists in every locale file; keys the issue does not cover keep the English text and are listed in the pull request so a translator can fill them in. Nothing renders as a bare key.

There are no tests in this repository. What is the check?

The production build, the Prettier check and the preview server. The agent fetches the home, login and settings pages in each locale and the output is in the transcript; a follow-up can add Playwright tests that assert the same thing on every pull request.

More SvelteKit jobs

The same job on other stacks

Keep reading