[orm-devel] How to handle multi language?
Werner F. Bruhin
werner.bruhin at free.fr
Fri Jun 24 12:21:01 CEST 2005
Diedrich Vorberg wrote:
> Hi Werner,
>> Why are you both leaning to the column per language approach instead
>> of a row per language approach (txtid, langid, text).
> for me personally it's about design and clean modeling, really. One
> data-entity (i.e. row) per real world object. It just "makes sense" to
But what is the real world object in this case?
I am not talking about the country here but the translation! For you
being German (am I right) and me being Swiss (of the german variety ;-)
) the real world object is "Deutschland" but as I live in the South of
France it could also be "Allemagne" or for my wife (New Zealander) it
would be "Germany".
> There's an alternative, though: one table per language, containing all
> localizable columns, one table with the non-locale depending data,
> sharing a single primary key. As in
> CREATE TABLE tree
> tree_id SERIAL,
> height INTEGER NON NULL,
> color TEXT NON NULL DEFAULT 'green'
> CREATE TABLE tree_de
> tree_id INTEGER REFERENCES tree(id),
> name TEXT
> To retrieve data one would JOIN the tree table with the "tree_%s" %
> lang table. This could be accomplished using orm's join class. To
> modify data you'd need one dbclass for the common data, one for each
> language table, whoes columns dict is a deep copy of a template.
> This could be a compromise, perhaps? ;-)
My initial reaction was this is even worse then having a column per
language but :-\ (undecided), I will sleep over it.
See you and thanks again for comming up with suggestions/ideas.
More information about the orm-devel