Skip to content
commitius

How do you build a multilingual website? Domains, language folders and hreflang

Country domains or one .com with language folders? Why to rewrite rather than translate, how hreflang works, and how i18n is set up in Next.js.

Can DemirFounder & author · 5 min read
A cork world map on a pale grey wall with a small wooden sailboat in the middle of the ocean

It depends on the domain name and your strategy. A country-specific domain such as .de is like opening a new site in that country, and it comes with that country's rules. If you are going global under one brand, a .com domain with language folders such as /en/ and /de/ suits better. For each language you should rewrite the text for that language's reader rather than translate it from Turkish. You link the language versions with hreflang so that your SEO is gathered in one place, and you build it with i18n, the internationalisation setup.

Country domains or language folders?

Google's documentation on multi-regional sites lists the options with their pros and cons. A country-specific domain (example.de) makes the target country clear and keeps sites easy to separate. Against that, it can be expensive, it needs more infrastructure, some extensions have strict requirements, and it can target only one country. A subdirectory (example.com/de/) is easy to set up and light to maintain, because it lives inside the same site. Its downsides are that visitors may not recognise the targeting from the address and that separating the sites is harder. A subdomain (de.example.com) is easy to set up and can sit on different servers, but there too it may be unclear whether the address shows a language or a country. URL parameters (site.com?loc=de) are not recommended.

Country domain (.de)A separate domainfor each countryThat country's lawcomes into playBuilt and run likea new site.com and language foldersOne domain, /en/and /de/ foldersMaintained insideone siteSEO gathered inone place

When you choose a country domain, you look like a business established in that country, and its rules come into play. For example, for commercial digital service providers in Germany, section 5 of the DDG requires the name, address, email address and, where there is one, the commercial register entry to be easy to find and permanently available. Whether a duty like that applies to you is something to check against that country's law and with a lawyer. Language folders run on one domain, so they duplicate this work less, but they do not remove the rules.

Translate the Turkish or rewrite it?

Rewrite it. In any sector, the words customers search for and the questions they ask do not translate one to one. A German-speaking buyer does not search with the translation of your Turkish heading. They search with the question they would ask in their own language. Writing the text from scratch for that reader works better, both in search results and in persuading the person reading.

Google is careful here too. Its documentation asks for each page to be written in one language, and says that translating only boilerplate such as menus and footers while leaving the main content in another language makes a poor experience. Its spam policies say that automated translation can count as scaled content abuse when little value is provided to users. The test is not how the content was produced but what it adds for the user. Machine translation can be a draft, but someone who knows the language should read it before it goes live. Translating a product catalogue with AI and putting it through that check is covered on our AI translation page.

What exactly does hreflang do?

It tells Google which languages and regions the same page exists in, so that search shows the visitor the right version. Google's documentation spells out the rules.

One of three methodsAn HTML tag, an HTTP header or a sitemap. Usingall three adds no benefitLinks in both directionsIf page A points to B, B must point back to A,or the annotations may be ignoredLinks to itself tooEach version lists itself and the otherversions in the same setFull addressWrite the full address with the protocol, not arelative path like /de/x-defaultAn optional fallback page for visitors whoselanguage matches none of your versions

The language code follows ISO 639-1, with an optional region code after it, for example de or de-AT. A region code on its own is invalid. Google also advises offering users links to choose a version rather than redirecting them to a language version automatically, and using a separate address for each language.

How is a multilingual site built with i18n?

i18n is short for internationalisation. It means managing the language choice, the translation files and the addresses in one consistent way. The Next.js internationalization guide says routing can be done by sub-path (/fr/products) or by domain (my-site.fr/products). All pages sit under app/[lang], and a separate dictionary file is read for each language. Because the dictionaries run in server components, the size of the translation files does not add to the JavaScript sent to the browser. With generateStaticParams the pages for each language can be produced ahead of time at build, and the lang value can be written onto the html tag.

This arrangement keeps the language versions in one codebase and makes it easy to generate the hreflang tags for every page from one place. We build multilingual sites this way as part of website development. The page list does not have to be identical from language to language, but every language version should be properly written. It is better not to publish a page in a language at all than to leave a half-translated one.

Share

Working on something similar?

Tell us in a few sentences what you want to do, and we will work out the right way together.