Skip to content

One codebase, three languages: what held and what we redid

One product, three languages, is not a translation job. The routing, article key and legal version decisions that held, and the two we had to redo.

· Ashar team · 5 min

In short

  • The language is part of the address, and every article exists in three languages from the day it is published.
  • Three files, one key: the link between versions is generated at build time, never typed by hand.
  • Two decisions had to be redone: how a language code resolves to a version, and when a legal text becomes effective.

English first, three languages always

When English became the first language of this blog, the decision came with a rule that costs more than it looks. No article goes out in one language only. Every piece exists in English, Portuguese and Spanish from the day it is published.

Two reasons. The product is read by companies outside Brazil that are looking at the country, and by companies inside Brazil that work in Portuguese. A page that exists in only one language splits that audience and leaves one half guessing. The second reason is timing: a translation written weeks after the original starts from a text that has already changed, and the three versions stop saying the same thing.

The language is part of the address, not a setting stored somewhere. A reader who arrives from a search result in Spanish gets a Spanish page, and switching language changes the URL. That is what lets someone send a link to a colleague and know which language the colleague will read.

Three files, one article

Each language is a file of its own, with a slug of its own. The slug is not a transliteration of the English one: it is written for what people search in that language, because a Portuguese reader does not search in English.

What ties the three files together is a key, a short string the three share and nothing else does. The build reads every file, groups them by that key, and writes the link between the versions: each page declares the language of the other two, and the English one is the default for readers whose language we cannot tell. Nobody types those links, and that is the point. A typed link survives exactly until the day someone renames a file.

This design has a failure that is easy to miss. Change the key in one language and nothing breaks: the build passes, every page opens, the search results stay. The three pages simply stop pointing at each other, and nothing reports it. Months later each version is competing with its own translation for the same queries. The same class of bug appears in small details: a date written 03/04 is read as 3 April in one market and 4 March in another, so dates stay in one format in the source and are formatted per language at render.

A localised product fails quietly. Nothing returns an error when Portuguese silently serves the wrong version.

Portuguese arrived with two codes: pt and pt-br. Both are legitimate, and the region variant is the one that holds the content. For a while we published pages under one code while routes asked for the other. Nothing returned an error. The route rendered its fallback, and a document that existed did not appear. A reader looking for the privacy policy in Portuguese found a page without the version it should show.

The lesson is not "always use pt-br". It is that resolving a language code has to be one function, written down once, with the region fallback decided before the first page exists. Spread across components, the same rule becomes a bug that only a person reading that one document in Portuguese will ever find.

Legal text taught the second lesson. A legal document has versions, and a version only counts from an effective date. A placeholder that renders as the current version is worse than an empty page, because someone will rely on it. We changed the rule: a version without an effective date is not published, and a route that no longer has a document redirects to the one that exists instead of showing a shell.

Translating legal text is a different job. A regulatory claim keeps the number of the norm and its article in the same sentence, in all three languages, so a reader can open the source in Portuguese and land on the same paragraph.

What we would do again

Keep the content in the repository as files, next to the code that renders it. Keep one index built at build time, so a missing translation is an answer from the build and not a discovery in production. Keep the alternate links generated from the key, never typed.

What we would redo: decide the locale fallback and the version rule before the first page, not after the first bug. And write each slug for the local search from the start, instead of translating the English slug and correcting it later.

The same questions come back for anyone putting a product into three markets. What the integration layer has to carry is in our documentation, and payment institutions in Brazil only makes sense with the norm at hand in the original language.

Before you start

Sources

  • Ashar engineering decisions, October and November 2026: locale routing, the shared article key and the version rule for legal documents. Internal record, no client data.

Talk to us

Keep reading

This article is informational and is not financial, legal or accounting advice. Ashar is a technology company. Regulated services are provided by the licensed institutions we connect you to.