How to make a website in two languages with an AI agent
If your clients speak more than one language, your site should too. An AI agent can build and translate a multilingual site, and on a static site it is simpler than it sounds.
Choose a structure
There are two common ways:
- A separate page for each language, in its own folder: the main language at the root, Spanish in
es/. Each language has its own address, so search engines can show the right one, and you can send someone a link straight to their language. - One page with a switch that swaps the text with JavaScript. Fewer files, but a single address, and search engines usually see only one language.
For anything you want people to find in search, choose folders. On aiput.site a folder with its own index.html opens at the folder's address: es/index.html opens at /es/.
The request
Make the site bilingual: English at the root, Spanish in the es folder. Same design and structure. Translate all text, including buttons, image alt texts, the page title and the description. Add a language switch in the header that leads to the same page in the other language. Set the lang attribute on each page and add hreflang links between the versions.
Check the translation
Agents translate well, but read the result or ask a native speaker, especially prices, legal wording and headlines, where a literal translation sounds odd.
Do not redirect by browser language
It is tempting to send visitors to "their" language automatically. Don't: people travel and use phones set to another language, and search engine robots usually come without a language preference, so they might never see the second version. A visible switch is enough.
hreflang: telling search engines about the versions
These lines tell search engines that the page exists in two languages and where each version lives. Every version lists all of them, itself included, with full addresses:
<link rel="alternate" hreflang="en" href="https://your-site-address/">
<link rel="alternate" hreflang="es" href="https://your-site-address/es/">
<link rel="alternate" hreflang="x-default" href="https://your-site-address/">
The agent fills in your site's address.
The canonical tag on the second language
When you publish, aiput.site sets the home page's canonical tag to your site's address. The Spanish page needs its own canonical, pointing to /es/ rather than to the home page. Ask the agent to add it.
Keep the versions in sync
When something changes, ask for both languages at once: "Change the price to 45 on both language versions and update the website." Otherwise the versions drift apart, and the Spanish page ends up with last year's prices.
