How do you design a schema for multi-language content?
Short answer
Two approaches: a JSON column holding translations ({"vi": "...", "en": "..."}), compact with no JOIN; or a separate translation table with full constraints, indexes and per-language search. Either way you need a fallback for missing translations.
3 points to say:
- JSON: compact, no JOIN, new languages need no schema change; but hard to constrain and search per locale.
- Translation table: PK
(entity_id, locale), full constraints and per-language indexes. - Always have a fallback for missing translations; only translate display fields.
Keep reading the deep dive
Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.