A trilingual site: the hard part is fallback, not translation
I run my site in three languages — Uzbek, Russian and English. When I started, I assumed translation would be the hard part.
I was wrong. Translation is work, but it is understandable work. The real difficulty lies in another question: what do you show when the translation does not exist?
That question determines the whole architecture.
Two kinds of text
The first and most important decision is splitting the text on your site into two categories.
Interface text — buttons, menus, error messages, headings. There is not much of it, it rarely changes, and it must exist in all three languages.
Content — articles, project descriptions, page copy. There is a lot of it, it is added constantly, and some of it may exist in only one language.
Managing both with the same mechanism is the most common mistake. Interface text should live close to the code: a plain object, typed, guaranteed present at build time.
export const dict = {
uz: { readMore: 'Batafsil', backHome: 'Bosh sahifa' },
ru: { readMore: 'Подробнее', backHome: 'На главную' },
en: { readMore: 'Read more', backHome: 'Home' },
} as constContent lives in a CMS and its existence is not guaranteed. That difference drives every subsequent decision.
The fallback strategy
Here is the central question. A user requests a page in Russian, but the article exists only in Uzbek. What do you do?
There are three options, and each sends a different message.
Return a 404. Technically honest, but bad for the user: they clicked a link and landed in a void.
Hide it from the list. That is, the Russian listing only shows articles that exist in Russian. A clean solution, but a large share of your content becomes invisible.
Show the fallback language. If the Russian version does not exist, you show the Uzbek one.
I picked the third, and it was the right call. The reason is simple: my readers usually know two languages, and for them "read it in another language" beats "do not read it at all".
The implementation:
function pickLang<T extends { lang: string }>(rows: T[], want: string) {
return rows.find((r) => r.lang === want)
?? rows.find((r) => r.lang === 'uz')
?? rows[0]
}Three steps: the requested language, the primary language, the first that exists. That last step matters — without it the page ends up empty when an article exists only in English.
One important condition: if you serve a fallback language, you have to tell the user. A small note is enough: "this article is currently available in Uzbek only". Otherwise they will assume the site is broken.
Routing: the language belongs in the URL
There are several places you could store the language: a cookie, a browser setting, or the URL.
The answer is unambiguous: the URL. /uz/blog/..., /ru/blog/....
The reason is the problems cookies create:
- Share a link and the recipient sees a different language
- Search engines see only one version
- Caching breaks — one address returns different responses
Auto-detecting the browser language is useful, but only once: when a user lands on the root address, you redirect them to a suitable language. After that the choice lives in the URL and you leave it alone.
In my setup this runs through a middleware layer that sets a language header. It resolves the language once and passes it down the tree, so no component has to recompute it.
SEO: hreflang and canonical
This is where mistakes happen most often, and they happen silently.
Every page has to emit three things.
Canonical — the primary address for this page. An important trap: do not declare it in the shared layout. Do that, and every page canonicalises to one address and drops out of the index. I made that mistake once, and fixing it meant waiting for the search engine to reindex.
hreflang — the versions of this page in other languages. It tells the search engine "this is a translation, not a duplicate".
<link rel="alternate" hreflang="uz" href="https://example.com/uz/blog/post" />
<link rel="alternate" hreflang="ru" href="https://example.com/ru/blog/post" />
<link rel="alternate" hreflang="en" href="https://example.com/en/blog/post" />
<link rel="alternate" hreflang="x-default" href="https://example.com/uz/blog/post" />x-default is for users whose language cannot be determined. Do not skip it.
The `<html lang>` attribute. A small thing, but it affects screen readers and browser translation. In many projects it stays hardcoded to en — check yours.
Include all three languages in your sitemap too. The search engine needs to find every version.
The translation workflow
Beyond the technical side there is a practical question: how do translations actually come into being?
In my setup content is created in all three languages at once from a single source — one slug, three rows. That is an important detail: the slug is not translated. If each language has its own slug, switching between languages gets complicated and writing hreflang gets harder.
For interface text there is a different rule: when you add a new key, it must be added in all three languages at once. You can force this with the type system — derive the dictionary's type from one language and the compiler will complain about missing keys in the others.
That simple trick prevents the "I'll translate it later" state.
What not to translate
A few things get translated needlessly.
Technical terms. "Deploy", "commit", "pull request" — forcing a translation makes the text less clear. Your readers know these words in their original form.
Text inside code. Variable names and strings in code examples are not translated. Only comments can be.
Proper nouns. Project names, product names, brands.
The rule: translation should help the reader, not make the text "complete".
How hard is it
The honest answer: hard on day one, easy afterwards.
Most of the work is up front — routing, fallback logic, hreflang, dictionary structure. That is one day of work.
After that, the only extra work per new page or article is the translation itself. And if your content system is built to create all three languages at once, even that is not a separate step.
If you are starting out, this is the order: URL-based routing first, then a typed interface dictionary, then the fallback function, and hreflang plus sitemap last. Verify each stage separately — especially canonical, because a mistake there is the most expensive and the hardest to notice.