[orm-devel] How to handle multi language?

Diedrich Vorberg diedrich at tux4web.de
Thu Jun 23 22:21:06 CEST 2005


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 
me.

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? ;-)

Diedrich

-- 
Diedrich Vorberg <diedrich at tux4web.de>      .---.   /             \
http://tux4web.de Tel: 02302 425269        /     \ ((__-^^-,-^^-__))
                                            \.O-O./  `-_---' `---_-'
"Unix is simple, but it takes a genius     /`\_/`\   `--|o` 'o|--'
to understand the simplicity."            //  _  \\     \  `  /
                       - Dennis Ritchie   | \     )|_     ): :(
                                         /`\_`>  <_/ \    :o_o:
      Associate Member of the FSF #1245  \__/'---'\__/     "-"



More information about the orm-devel mailing list