Best way to setup a i8n in a database

148 Views Asked by At

i face the problem to develop a database with a support of multi languages. My first approch was it, to write for each language a extra table. For example I handle recipes, so I created various templates according to the language:

- enRecipe
- deRecipe
- frRecipe

Is this correct or is their a better approach?

1

There are 1 best solutions below

1
On BEST ANSWER

The main problem with the design will be shown when other languages needs to be added to the design, when you will need to add more tables.
Also it would be hard to find witch language have not implemented specific recipe keys.

I will suggest having a design like bellow:
enter image description here

About the comment:
To generalize the solution for other entities like Ingredients, there may be alternatives:

  1. Having a Resource table that contains sting resource keys, it will be very likely to have resource files in your application (files are replaced with tables).
    Note that in this design text keys are separated from business entities like Recipe and Ingredient. enter image description here
  2. A more specific design will be having a base table for every business entity that may need multi-language support, this base table will have the the name key that must be translated. enter image description here