Building a Multilingual Legal Content Pipeline for EU E-Commerce Sites
The problem nobody budgets for If you're building or maintaining an e-commerce platform that sells into multiple EU countries, there's a good chance your legal pages are an afterthought. One terms.html, maybe translate
The problem nobody budgets for
If you're building or maintaining an e-commerce platform that sells into multiple EU countries, there's a good chance your legal pages are an afterthought. One terms.html, maybe translated once with a paid API call, deployed to every locale, and forgotten.
That approach has a legal problem, which is well covered in this breakdown of EU language requirements for terms and privacy policies. Short version: under the Consumer Rights Directive and GDPR Article 12, your terms and privacy policy need to exist in a language the consumer actually understands, not just English with a disclaimer.
What that article doesn't cover, and what's actually relevant to the people shipping the code, is how to build the pipeline that keeps these documents correct, versioned, and in sync across markets without manual copy-pasting every time legal changes a clause. That's what this post is about.
Why this isn't a normal i18n problem
Standard i18n tooling (react-intl, i18next, Lokalise, Crowdin) is built around UI strings: short, reusable, forgiving of minor imprecision. Legal content is the opposite:
- Long-form, structured text with cross-references ("as defined in Section 4.2")
- Zero tolerance for terminology drift between versions
-
Jurisdiction-specific legal terms that don't have a 1:1 translation (e.g. Germany's
Widerrufsrechtcarries a specific statutory withdrawal period that a generic "right of cancellation" doesn't convey) - Audit requirements — you need to prove what version a user agreed to, in what language, and when
Treating your privacy policy like a button label ("Submit" → "Soumettre") is how companies end up with seven inconsistent return policies and a GDPR complaint.
A practical architecture
Here's a setup that works reasonably well for teams managing legal content across several EU markets.
1. Separate legal content from your i18n string files
Don't dump legal text into the same JSON files as your UI copy. Keep it in versioned Markdown or structured documents per locale:
/legal
/terms
en.md
de.md
fr.md
pl.md
meta.json # version, effective_date, reviewed_by, source_hash
/privacy-policy
en.md
de.md
...
Each meta.json tracks which source version a translation was derived from:
{
"version": "2024-06-1",
"source_lang": "en",
"source_hash": "a1b2c3d4",
"translated_at": "2024-06-03",
"reviewed_by": "legal-translation-vendor",
"effective_date": "2024-06-10"
}
2. Diff the source before triggering retranslation
You don't want a full retranslation every time someone fixes a typo. Hash the source content and only flag a translation as stale when the hash changes meaningfully:
import hashlib
def content_hash(text: str) -> str:
return hashlib.sha256(text.encode("utf-8")).hexdigest()
def needs_retranslation(current_source: str, meta: dict) -> bool:
return content_hash(current_source) != meta["source_hash"]
Run this as a CI check on your legal repo. If needs_retranslation returns true for any locale, open a ticket or trigger a request to your translation vendor instead of silently deploying outdated text.
3. Use a translation memory, not a stateless API call
Machine translation APIs (DeepL, Google Translate) are stateless by default: every call is independent, so terminology can drift between your terms and your privacy policy, or between v1 and v2 of the same document. For legal content you want:
- A glossary enforcing fixed translations for defined terms (data controller, processor, legal basis, withdrawal period)
- A translation memory (TM) that reuses previously approved segments instead of retranslating from scratch
DeepL's API supports glossaries directly:
import deepl
translator = deepl.Translator(auth_key)
glossary = translator.create_glossary(
"legal-de",
source_lang="EN",
target_lang="DE",
entries={
"right of withdrawal": "Widerrufsrecht",
"data controller": "Verantwortlicher",
"data subject": "betroffene Person",
},
)
result = translator.translate_text(
source_text,
source_lang="EN",
target_lang="DE",
glossary=glossary,
)
This is fine for drafts and internal review, but machine translation alone is not sufficient for publishing these documents live. Use it to produce a first pass that a qualified legal translator reviews, not as the final output. A terminology mismatch in a withdrawal clause is a contract dispute waiting to happen, not a typo users will laugh off.
4. Gate deployment on review sign-off
Treat legal translations like a migration: nothing goes live without sign-off recorded in your metadata. A simple CI gate:
# .github/workflows/legal-check.yml
name: Legal content check
on:
pull_request:
paths:
- 'legal/**'
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check reviewed_by is set for all locales
run: python scripts/check_legal_meta.py
check_legal_meta.py just fails the build if any meta.json has a null reviewed_by field for a locale that's about to be deployed. Crude, but effective at stopping an unreviewed machine translation from reaching production.
5. Log what the user agreed to
When a user accepts your terms, store the locale and version, not just a boolean:
CREATE TABLE consent_log (
user_id UUID,
document_type TEXT, -- 'terms' | 'privacy_policy'
locale TEXT, -- 'de', 'fr', 'pl'
version TEXT, -- '2024-06-1'
accepted_at TIMESTAMPTZ
);
If a dispute arises six months later, you need to reconstruct exactly which German-language version of your terms a specific user agreed to, not just that "terms were accepted."
Where to draw the line between automation and legal review
Automating the pipeline gets you:
- Fast detection of stale translations when source content changes
- Consistent terminology via glossaries and TM
- A clean audit trail for compliance
It does not replace a qualified legal translator validating the terminology against each destination country's consumer protection law. The source article covers this distinction well: these documents generally don't require sworn translation for B2C EU sales, but they do need rigorous certified legal translation, which is a different bar than what an API gives you out of the box.
If you're scaling into new EU markets, the engineering problem is making sure translated legal content stays in sync with your codebase and audit requirements. The legal problem, what actually needs translating and to what standard, is covered in detail in the source article on translating terms and privacy policies for EU markets.
Build the pipeline so legal review is a gate, not an afterthought, and you'll avoid both the compliance risk and the 11pm Slack message asking why the Polish terms page still says "Lorem ipsum."
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.