2009/5/15 Sergei Beilin <[email protected]>:

>> IMO, the translations for all entities should be stored in a single
>> table and not in one table per translated entity. The difference with
>> the versioned plugin is that for versioning, you don't know in advance
>> the type of columns, whereas in a translation framework, you do know
>> those are going to be strings.
>
> We are translating not strings, but entities. Keeping the strings in
> one table makes it difficult to 1) construct the translated entity 2)
> keep in mind the context of a translated string. My approach will
> return the default entity if there's no translation of the whole
> entity in required language.

You could keep the same interface and just store the data differently.
The only limitation to storing in a single table is that you need to
have the same type of primary keys accross all the entities you want
to be translatable.

>> You might want to cache the "base" instance when accessing one
>> "ignored" attribute on the translated version, because in your current
>> code you'll trigger a query for each attribute.
>
> How do I accomplish this?

You use a property. Something like this:

def baseinstance(self):
    if self._baseinstance is None:
        # do the query here
        self._baseinstance = xxx
    return self._baseinstance


-- 
Gaƫtan de Menten
http://openhex.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to