Design a Multi-Locale String Delivery System
System DesignModel answerLast updated
Design a system that serves translated strings to clients worldwide, handling locale resolution, variables, plurals, live updates, fallback, and offline support.
The Problem
Your company ships a product to users across dozens of countries. Every string a user sees must be translated, formatted correctly for their locale, and updatable by the content team without waiting for a new app release.
Design the system that makes this work end to end.
What the system must do
- Resolve the right translation for a given locale, including both language and region (e.g.,
pt-BRvspt-PT). - Interpolate dynamic values (names, counts, prices) into translated strings safely.
- Apply language-specific plural rules so that, for example, Russian and Arabic get the correct grammatical forms for quantities.
- Format dates, numbers, and currencies according to locale conventions.
- Fall back gracefully when a translation is absent, rather than crashing or showing a key name to the user.
- Allow the content or localization team to push copy edits that users see without an app release.
- Support clients that start up with no network connection.
- Switch the active locale at runtime without restarting the application.
Constraints and assumptions
- Translation source-of-truth is human-authored. A default-language bundle (typically English) ships inside the application binary.
- Clients — web, iOS, Android — all consume the same translation catalog.
- Strings may contain placeholders like
{userName}or{count}. - Legal or regulatory strings may not be allowed to fall back; the system should support flagging them.
- The team needs an approval and rollback workflow, not raw file drops.
Expected scope
This is an open-ended design question. Walk through your architecture from catalog schema to client rendering. Cover the translation workflow, bundle publication, client caching strategy, and how you handle failure modes. Interviewers will probe missing-key detection, formatting edge cases, and how copy changes reach users quickly and safely.
Clarifying questions worth raising
Before diving in, a strong candidate asks:
- What is the acceptable propagation delay for an approved copy change — seconds, minutes, hours?
- Which client versions must remain compatible with the same catalog?
- Are there strings that must block on translation completion before a feature ships?
- Who owns approval, and is there a rollback window?
- Does the system need to support copy experiments (A/B testing within one locale)?
Hints
Hint 1
Start with the catalog schema: how you name keys and structure locale identifiers shapes everything downstream. Think about what information a client needs to render a string versus what only the pipeline needs.
Hint 2
Separate the question of how a bundle gets from the server to the client from the question of how it gets from disk into memory. Offline startup, cache invalidation, and live switching are three different problems with different solutions.
Hint 3
Work through failure modes explicitly: what happens when the CDN is unreachable, when a placeholder is missing from the translated string, and when a translation was approved but contains a layout-breaking string 3x longer than the English source?
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Catalog Schema and Key Design
Translations live in a catalog keyed by a semantic identifier like onboarding.welcome.title rather than the English string itself. Using the English text as a key creates a maintenance problem whenever the source copy changes. Each key maps to a per-locale record that includes the translated string, optional plural variants, a format version, and a flag for whether fallback is permitted.
Locale identifiers follow BCP 47: zh-TW, en-GB, pt-BR. The system defines a fallback chain per locale — zh-TW → zh → en — so the resolver walks the chain and returns the first hit. For strings flagged no-fallback (legal disclaimers, regulatory notices), a missing translation is surfaced to the localization team as a blocking issue and the string is held from rendering until resolved; you never silently show English to a user where that is a compliance risk.
Translation Workflow and Versioning
Translators work in a content management system (a dedicated TMS or a thin internal tool backed by a database). A change goes through: draft → peer review → legal/brand check if flagged → approval → publish. The system maintains a version number per bundle per locale. Each published snapshot is immutable; rollback means promoting the previous version, not mutating the current one.
Bundles are compiled into a binary format (MessageFormat 2 or a flat JSON with a checksum). The build pipeline runs completeness checks: any key present in the default-language bundle but absent in a target locale generates a warning or a build failure depending on the no-fallback flag.
Bundle Publication and CDN Delivery
On approval, the pipeline writes a versioned artifact to object storage (e.g., /{locale}/{version}/strings.json) and updates a manifest file (/manifest.json) that maps each locale to its current version and checksum. The manifest is the single pointer clients poll to discover updates. CDN caches the versioned bundles indefinitely (immutable URLs); the manifest itself has a short TTL or is fetched via long-polling/SSE for near-real-time propagation.
Propagation delay: with a 30-second manifest TTL and CDN edge caching, an approved change reaches most clients within one to two minutes. For sub-minute requirements you can use WebSocket push or SSE to notify clients to invalidate and re-fetch.
Client Architecture
The client has three layers:
- Embedded bundle — ships in the binary, always available, used for the default language and as the last-resort fallback. Never stale, but only updated at release.
- Disk cache — downloaded bundles stored on device. The client compares the cached version against the manifest on startup and in the background. This is what enables offline startup: the app reads from disk even with no network.
- In-memory store — the active bundle loaded into memory. Locale switching replaces the in-memory store without restarting the process; the disk cache already has the required bundle, or the client fetches and writes it before switching.
Cache invalidation uses the version field from the manifest plus a checksum integrity check. On mismatch the client redownloads. On CDN failure the client serves from disk, and from the embedded bundle if disk is also cold.
Interpolation, Plurals, and Formatting
Placeholder substitution uses a typed interpolation API rather than raw string replacement:
t("cart.item_count", { count: 3 })
The library validates that all placeholders declared in the catalog entry are supplied at call sites; a missing variable is a compile-time or lint error in strongly typed clients, not a silent runtime blank. User-supplied values are treated as data, never interpreted as format syntax — this prevents injection through translated strings.
Plural rules follow the Unicode CLDR plural categories (zero, one, two, few, many, other). Each key that involves a count stores one variant per applicable category for the target language. The client selects the variant using the locale's CLDR rules before interpolating.
Dates, numbers, and currencies are formatted using the platform's Intl APIs (browsers, iOS, Android all expose CLDR-backed formatters). Translations never embed formatted values directly; they embed a typed placeholder like {amount, number, currency} that the runtime formats according to locale.
Detecting Problems
Missing keys at build time: the pipeline diffs the default-language bundle against every target-locale bundle. Missing keys produce a report. Keys with no-fallback block the release pipeline.
Runtime telemetry: every fallback resolution fires a metric tagged with (locale, key). A dashboard shows coverage gaps across the live user population — useful because a key might exist in the catalog but not in a locale that has grown in user share since the last audit.
Text expansion and layout failures: English is typically the shortest form. German and Finnish strings can run 30–100% longer. Two tools catch this before users see it: pseudolocalization (replace characters with accented lookalikes and pad strings to ~130% length during development builds) and visual regression tests that render each screen at the expanded length and flag overflow or clipping. RTL (Arabic, Hebrew) requires mirrored layouts; the CI pipeline includes an RTL rendering pass.
Common Mistakes to Avoid
- Using English text as keys. Any English copy edit breaks all translations.
- Concatenating translated fragments. "You have" + count + "items" cannot be translated as a unit; word order varies by language.
- One plural rule fits all. Languages like Polish and Arabic have plural categories English lacks entirely.
- Mutable CDN URLs. Cache poisoning risk and no reliable rollback. Use immutable versioned URLs plus a separately-managed manifest pointer.
- Treating offline as an edge case. On mobile, offline startup is a first-class scenario; embed a default bundle and always write to disk before serving from memory.