4

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?

  • "Also the FAQ table needs to somehow make sure there's a full translation for each language". Not necessarily. Most systems I have worked with just have a "default language" to use to show content with no tranlation in the user language. – SJuan76 Jul 27 '14 at 17:18
  • Sure, I get the idea with having a default. What I mean is what if someone does a translation for one answer but not the rest? – Carlos Jul 27 '14 at 18:39
  • 3
    That is not part of the data model but of business logic, it is up to you if to define if your application allows showing items/pages that are only partially translated. – SJuan76 Jul 28 '14 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.