Design an Internationalization System
Understanding the Problem
🌍 What is an internationalization system? Internationalization (i18n) is everything that lets one product work in many languages and regions: keeping user-facing text out of code, translating it, choosing the right translation for each user, and formatting plurals, dates, numbers and currencies the way each locale expects. A large app has hundreds of thousands of strings in dozens of languages, written by thousands of engineers and translated by vendors and community translators. On top of that, social apps translate what users write, so a post in Portuguese can be read in Japanese.
This question gets asked in a few shapes: "design a string management system," "how would you support plurals and genders in 50 languages," "design the translation workflow for translators," and "design 'See translation' on posts." The first three are one system for the product's own text. The last is a separate pipeline for user content that shares the language plumbing. We'll cover both.
Functional Requirements
Core Requirements
- Developers should be able to add and change user-facing strings in code, and users should see each string in their own language, with a sensible fallback when a translation is missing.
- Strings should handle plurals, gendered and pronoun-dependent wording, and locale-specific formats for numbers, dates and currencies.
- Translators should be able to translate and review strings with enough context to get them right, and every change should be audited and reversible.
- Users should be able to read other users' posts translated into their language.
Below the line (out of scope)
- Translating long-form documents, images and video.
- Locale-specific product features (different payment methods per country).
- Building a machine translation model. We'll use one.
Non-Functional Requirements
Ask about the size of the product. Let's design for a large consumer app: 50 locales, 200,000 source strings, web and mobile clients, 500 million daily users, and 100 million new posts a day.
Core Requirements
- Looking up a string at runtime must be effectively free: an in-memory lookup, no network call per string.
- A new or changed string should be translated and live in all major locales within a few days, and a fix to an existing translation should reach users within minutes, without an app release.
- The system must never break the UI with a bad translation: a translation that fails to parse, drops a placeholder or is missing a plural form must be caught before it ships.
- Post translation should return in under 1 second at p95 and keep machine translation costs under control.
- Every change to a translation should be attributable and reversible.
Below the line (out of scope)
- Legal review of translated terms and policies.
The back-of-the-envelope changes the delivery design. 200,000 strings averaging about 60 bytes is roughly 12 MB per locale, before any JSON overhead. A web page can't download 12 MB of strings before rendering, and a mobile app can't ship 50 locales of that (600 MB) in its binary. So strings must be split into small bundles that each screen loads as needed, and mobile apps can only embed the locales a user is likely to need.
For posts: if 500M users each view 100 posts a day, that's 50 billion post views. Suppose 10% are in a language the viewer doesn't read and 2% of those get a "See translation" click. That's 100 million translation requests a day, about 1,200 per second. Machine translation costs on the order of $10-20 per million characters from cloud providers; at 300 characters per post that's 30 billion characters a day, hundreds of thousands of dollars a day if every request is a fresh translation. Viral posts get the same translation requested thousands of times, so caching is where the money is.
Put both numbers on the board. The first tells you strings are a build-and-CDN problem, not a database query. The second tells you post translation is a caching problem with an expensive backend, not a model problem.