I’ve developed some software that allows my users to attach a blurb to some non-language specific information:
Pseudocode model:
item():
ID
creationdate
byline //Only one byline for the object
description //Only one description for the object
faq:
faqID
question
answer
itemID //ForeignKey
So this is basically a simple model in which an info item has a description and any number of faq questions related to it.
If my user now wants to have translations for his description and faq questions, what is the canonical way to extend the model?
Some candidates that I thought of:
- Add an alias (FK to self) field on the info as well as a language field. Then have business logic that finds the desired language.
- Upside: required fields are required for any language entry. You create partial translations. You will be reminded when the schema adds another text field.
- Downside: There’s now two types of objects in the table: main language objects and alias objects.
- Add a table with all the language specific fields (description), and access the string via the foreign key
- Upside: clean, everything is it’s own type
- Downside: more tables. Also the FAQ table needs to somehow make sure there’s a full translation for each language.
So how would you do it?
3