Translate your website into 3 languages with Claude Code, without breaking it
Use Claude Code to add Spanish, Korean and Japanese versions of a small website, with a glossary, a language switcher and hreflang tags, then run a checker script that catches broken links, forms and missed text before you publish.
- Level Intermediate
- Time 45-90 minutes for a small site (2-10 pages)
- Works with
- Claude Code
On this page12 sections
Pasting your pages into a chat and copying the translations back works for one page. On a real site it breaks things: a form field gets “translated” and stops sending, an image path points nowhere, the button text in your JavaScript stays in English. This guide uses Claude Code, which works on the files in your site folder directly, to add three languages in a way you can check and undo.
We use Spanish, Korean and Japanese as the example. Swap in any three languages.
What you’ll have at the end
- Your site in four languages, each in its own folder:
/es/,/ko/,/ja/, with the English pages where they were. - A glossary file that keeps your brand name, product terms and tone the same on every page.
- A language switcher on every page, plus the
langattribute and hreflang tags that tell browsers and Google which language each page is in. - A
check_translations.pyscript that compares every translated page with the English one and lists anything broken. You can run it again whenever you change the site.
What you need
| Item | Details (per the official docs) |
|---|---|
| Claude Code | Install with curl -fsSL https://claude.ai/install.sh | bash (macOS, Linux, WSL) or irm https://claude.ai/install.ps1 | iex (Windows PowerShell). Homebrew and WinGet also work. |
| A Claude account | Claude Code needs a Pro, Max, Team or Enterprise plan, a Claude Console account, or access through a supported cloud provider. |
| Your website files | A folder of HTML, CSS and JavaScript on your computer. If your site is built with a framework or a site builder, see “What can go wrong”. |
| Git (recommended) | So you can undo everything with one command. |
| Python 3 | To preview the site locally and run the checker. Type python3 --version to check. If it’s missing, install it from python.org. |
Cost: on a Pro or Max plan, Claude Code use counts toward your plan’s usage limits; type /usage to see where you stand. On a Console (API) account you pay per token. For scale, Anthropic’s cost page reports an enterprise average of about $13 per developer per active day of coding.
Step 1: Make a safety net first
Open a terminal in your site folder. If it’s already a Git repository, make a branch for the translation work:
git add -A
git commit -m "Before translation"
git checkout -b translate
If you don’t use Git yet, run git init first, then the three lines above. If Git asks who you are on your first commit, run git config --global user.name "Your Name" and git config --global user.email "you@example.com". If you really don’t want Git, copy the whole folder somewhere safe.
Why not rely on Claude Code’s own undo? Claude Code saves a checkpoint before every prompt, and /rewind (or pressing Esc twice on an empty prompt) restores your files. But the docs list limits: files changed only by shell commands (for example a cp or a Python script that Claude runs) aren’t tracked, and checkpoints are meant for quick undo within a session, not as version history. A Git branch covers all of it.
Step 2: Write a glossary
Claude handles these languages well: in Anthropic’s multilingual benchmark table (Sonnet 4.5 and Haiku 4.5), Spanish, Korean and Japanese all score between 93% and 98% of Claude’s English score. What it can’t know is your choices. Is your product name translated? Formal or casual tone? The glossary answers that once, so page 7 matches page 1.
Save this as glossary.md in the site folder and change it to fit your site:
# Translation glossary
## Languages
- es: Spanish for Spain and Latin America. Friendly "tú".
- ko: Korean. Polite 해요 style.
- ja: Japanese. Polite です/ます style.
## Never translate
- Hana's Bakery (brand name)
- Mill Street, Riverside (address)
- hello@hanasbakery.example
## Always translate this way
- sourdough: es "pan de masa madre", ko "사워도우", ja "サワードウ"
- Pre-order: es "Reservar", ko "미리 주문", ja "予約"
## Rules
- Keep times in 24-hour format, as in English.
- Don't add claims, prices or facts that aren't in the English page.
Write the term choices down even if you’re not sure yet. It’s easier to fix one line in the glossary than the same word on 20 pages.
Optional: to make Claude follow the glossary in every future session, add one line to a CLAUDE.md file in the folder: When translating, always follow glossary.md. Claude Code reads CLAUDE.md at the start of every session.
Step 3: Look before you change anything (plan mode)
Start Claude Code in the folder:
claude
Press Shift+Tab until the status bar shows ⏸ plan mode on. In plan mode, Claude reads your files and proposes a plan, but doesn’t edit anything until you approve it. Then send:
I want to translate this site into Spanish (es), Korean (ko) and Japanese (ja). Don't change anything yet. List every page, every place with text people read (including alt text, meta descriptions, button labels and text inside JavaScript files), and anything that could break when pages move into subfolders, like relative paths, forms or scripts. Then propose a plan.
Read the plan. Check that it found the text hidden in your JavaScript (a “Sending…” message, an error message), and that it isn’t planning to touch form field names or your form’s action URL. If something’s wrong, choose to keep planning and tell it what to change.
Step 4: Translate
Don’t approve the Step 3 plan yet, because approving starts the edits. In the plan menu, choose No, keep planning and send this prompt instead. Check the new plan Claude writes, then approve it. We ran this exact text with claude -p on a two-page sample site (see “What we saw when we tested it”).
Translate this website into Spanish (es), Korean (ko) and Japanese (ja). Follow glossary.md exactly.
Structure:
- Keep the English pages where they are. Put each translation in its own folder: /es/, /ko/, /ja/, with the same file names.
- Translate only text people read: visible text, <title>, meta description, alt text, button labels, form labels and any text that script.js shows on screen.
- Do not change HTML structure, ids, classes, form field names, form actions or the image files. Fix relative paths in the translated pages so CSS, scripts, images and links still work from inside the folder.
- Set <html lang> on every page (en, es, ko, ja).
- Add a small language switcher to the header of every page, English included. Write each language name in its own language (English, Español, 한국어, 日本語).
- In the <head> of every page, add <link rel="alternate" hreflang="..."> tags for all four languages plus x-default pointing to English. Use full URLs starting with https://www.example.com/ (I'll replace the domain later).
When you're done, list every file you created or changed, and anything you weren't sure how to translate.
Replace https://www.example.com/ with your real domain if you have one.
Why each rule is there:
- Separate folders (
/es/,/ko/) are what Google’s guide calls subdirectories: easy to set up and low maintenance, on the same host as your English site. langtells browsers and screen readers which language the text is in. MDN notes that screen readers use it to pick the right pronunciation.- hreflang tags tell Google which pages are versions of each other. Google’s rule: each language version must list itself and all the others, with full URLs.
x-defaultis the page for everyone else. - One language per page. Google works out a page’s language from its visible text, not from the
langattribute or the URL. A page that mixes English and Korean confuses that. - A switcher, not a redirect. Google advises against automatically redirecting visitors to a language based on a guess. Let people choose.
Step 5: Check that nothing broke
Translation mistakes are easy to see. Broken plumbing isn’t. Ask Claude to build a checker:
Write a script called check_translations.py (Python standard library only) that checks the translated pages didn't break anything, then run it and fix what it finds.
For every English page and its copy in /es/, /ko/ and /ja/, check:
1. The same number of links, images, forms, inputs and buttons as the English page.
2. Every id, class, form action and form field name is unchanged.
3. Every local link, stylesheet, script and image path points to a file that exists.
4. <html lang> matches the folder.
5. Every page has hreflang tags for en, es, ko, ja and x-default, and each one points to a page that exists.
6. No English sentence from the English page was left untranslated (ignore the brand name, address and email in glossary.md).
Print one line per problem and a final count. Exit with code 1 if there are problems.
Then test the checker itself. A checker that always says “0 problems” proves nothing. Break one page on purpose, for example change lang="ja" to lang="en" in ja/index.html, and run:
python3 check_translations.py
It should report the problem. Change lang="en" back to lang="ja" and run it again. The checker only catches English text copied over word for word, so a half-translated sentence still needs a human eye (Step 6).
Step 6: Look at it, then get a human to read it
Preview the site on your computer:
python3 -m http.server 8000
Open http://localhost:8000/, click through the switcher on every page, and submit a form if you have one. Press Ctrl+C to stop the server. Python’s docs warn that this server is not recommended for production, so use it only for previewing.
Then, for each language, ask one native speaker to read the pages, especially the headline, the buttons and anything legal or about money. Anthropic’s multilingual guide also says good communication often needs cultural awareness beyond pure translation, and your glossary can’t cover that.
When you’re happy, commit and merge the branch:
git add -A
git commit -m "Add Spanish, Korean and Japanese"
git checkout main
git merge translate
(Use master instead of main if that’s your branch name.) To publish, follow Build a simple website and put it online with Netlify; the Netlify MCP server can deploy the whole folder, translations included.
What we saw when we tested it
We ran the Step 4 and Step 5 prompts with claude -p on a made-up two-page bakery site with a pre-order form and a script.js that changes the button text to “Sending…”:
- It created
es/,ko/andja/with both pages, changed the paths to../styles.cssand../images/loaf.jpg, and left the form action and field names alone. - It made a translated copy of
script.jsin each folder, because the “Sending…” text needed translating (Enviando...,보내는 중...,送信中...). - It flagged its own doubts: the English page says “from 5 a.m.”, but the glossary says 24-hour times, so it wrote 5:00 and asked us to confirm. It also pointed out that the Korean button used 예약 while the glossary’s term for pre-order is 미리 주문.
- It said the switcher had no CSS yet, and that it hadn’t opened the pages in a browser.
- The checker reported 0 problems. When we broke a field name, an
<html lang>and a heading by hand, it caught all three.
Read Claude’s “not sure” list carefully. It’s where the real decisions are.
What can go wrong
- Forms stop working. If a field
namegets translated, your form service receives the wrong field. The checker’s rule 2 catches this. - Text inside JavaScript stays English. Alerts, “Sending…” messages and error text often live in
.jsfiles. Name them in the prompt, as Step 4 does. - Paths break one folder down.
styles.csson a page in/ko/looks for/ko/styles.css. The checker’s rule 3 catches missing files. - Your site uses a framework (Astro, Next.js, Hugo and others) or a builder like Wix or Squarespace. Don’t copy HTML files around. In a framework project, start in plan mode and ask Claude to use the framework’s own translation (i18n) feature. In a hosted builder, use the builder’s language settings; Claude Code can’t edit those files.
- Pages go out of date. When you change an English page, the translations don’t change with it. Ask Claude:
I changed index.html. Update the es, ko and ja copies to match, following glossary.md, then run check_translations.py. - Something went badly wrong. Type
/rewindand pick the point before the prompt, or throw away all the translation work: rungit add -A,git commit -m "Discard",git checkout mainandgit branch -D translate. - It’s still a machine translation. Claude’s translations are good, but they aren’t reviewed. For legal pages, prices, health claims or anything people sign, have a qualified person check them.
Make it yours
- Different languages. Change the folder codes, the glossary and the switcher names. For a right-to-left language like Arabic, also ask Claude to set
dir="rtl"on those pages and check the layout. - Regional versions. Use codes like
es-MXorpt-BRif you write different text for different countries. - Check it in a real browser. Add Playwright MCP with
claude mcp add playwright npx @playwright/mcp@latest, keeppython3 -m http.server 8000running in a second terminal, then ask:Open every page in every language at localhost:8000, click the language switcher, and tell me about anything that looks broken or cut off.Translated text is often longer or shorter than English, so watch the buttons. - Make the checker part of your routine. Run
python3 check_translations.pybefore every publish.
Next steps
Sources
- code.claude.com/docs/en/quickstart (opens in a new tab)
- code.claude.com/docs/en/setup (opens in a new tab)
- code.claude.com/docs/en/permission-modes (opens in a new tab)
- code.claude.com/docs/en/checkpointing (opens in a new tab)
- code.claude.com/docs/en/memory (opens in a new tab)
- code.claude.com/docs/en/costs (opens in a new tab)
- platform.claude.com/docs/en/build-with-claude/multilingual-support (opens in a new tab)
- developers.google.com/search/docs/specialty/international/localized-versions (opens in a new tab)
- developers.google.com/search/docs/specialty/international/managing-multi-regional-sites (opens in a new tab)
- developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/lang (opens in a new tab)
- docs.python.org/3/library/http.server.html (opens in a new tab)
- raw.githubusercontent.com/microsoft/playwright-mcp/main/README.md (opens in a new tab)
Related guides
Claude Design vs Figma MCP: which to use for UI work
Claude Design drafts screens for you; Figma MCP lets Claude read and edit your Figma files. Compare plans, limits and handoff, then use both in one workflow.
Beginner10 minutes to decide, about 30 minutes for the hands-on workflow
Deploy a website with Claude and Netlify (MCP, CLI or Drop)
Deploy a website with Claude: Claude Code builds it, Netlify MCP or CLI puts it online. Also Drop, Claude Design, free credits and making it public.
Beginner30-60 minutes
Restyle your site with a modern design using Claude's frontend design skill
Give an old-looking web page a modern look with Claude Code and Anthropic's frontend-design skill: a bento grid, bold type, automatic dark mode and one calm entrance animation that switches off for people who ask for less motion. Your text stays exactly the same.
Beginner30-45 minutes