Lukas Knuth
Lukas Knuth

Reputation: 25755

Multilingual database design pattern

I'm currently working on Blog-Software which should offer support for content in multiple languages.

I'm thinking of a way to design my database (MySQL). My first thought was the following:

The idea of this is that one article can be translated into multiple other languages, but it doesn't need to be. If there is no translation in the native language of the user (determined by his IP or something), he sees the standard language (which would be English).

For me this sounds like a simple multilingual database and I'm sure there is a design pattern for this. Sadly, I didn't find any.

If there is no pattern, how would you go about realizing this? Any input is greatly appreciated.

Upvotes: 5

Views: 1414

Answers (3)

Jean-Francois
Jean-Francois

Reputation: 76

That design will also give you the ability to search (or restrict search) in all languages easily. From a db design perspective, its imho the best design you can use.

Upvotes: 1

Tom H
Tom H

Reputation: 47464

Your approach is what I've seen in most applications with this kind of capability. The only changing piece is that some places will put the "default" values into the base table (Entry) while others will treat it as just another Content row.

Upvotes: 6

Stephan Eggermont
Stephan Eggermont

Reputation: 15907

With small amounts of text and a simple application this would work. In the large, you might be bitten by the extra joins needed, especially when your database is larger than ram. Presenting things in the right order (sorting) also might need solving

Upvotes: 0

Related Questions