In my current project ( a custom CMS written in django ), our solution for I18N models is based on this example snippet : http://www.djangosnippets.org/snippets/855/ , which I extended to be more usable in templates and integrated within the administration interface.
Basically, each kind content has two tables : one with the common fields ( like articles' category ) and one with translatable content ( title, body, slug - unique label used in the url - etc. ). Obviously there is a ony-to-many relationship between common model and translation model. Here's the example the author gives :
class Article(models.Model):
author = models.CharField(max_length = 40)
class ArticleI18N(I18NModel):
title = models.CharField(max_length = 120)
body = models.TextField()
I think that this way, the database layout is really close to the concept of having content with common attributes and translatable fields.
But then the tricky part is staying DRY in your code, or you'll end up with a mess of boilerplate every time you need to handle translatable content. Fortunately python's flexibility was of great help.
If your programming language and environment do not allow similar tricks ( like dynamic creation of subclasses, python's metaclasses - some kind of inheritance hook, etc. ), I guess this kind of database layout is going to be more a curse than a blessing.
So, keep the YAGNI principle in mind. If you need translations inside your models with less complications, I've seen other effective ways, which are fine as long as you can afford the limited flexibility and the lack of conceptual integrity of those alternatives :
- 1) use additional columns for every translatable column and every language : title_en, title_fr, title_de, content_en, content_fr, content_de, ...
- 2) serialize multiple languages in one column.
For instance : title = "|EN|Welcome|FR|Bienvenue|DE|Willkommen"
I don't like that one particularly, but what matters really here is whether it's integrating nicely within an existing environment, which was the case.
- 3) Sometimes the link between the same content in different languages doesn't need to be strict. I think it's the case of the articles in wikipedia - translations are just hyperlinks manually set by the authors. As a consequence, those links are less exploitable by the software, but what matters here is being browsable by a user.