OdifYltsaeb / django-multilingual

Automatically exported from code.google.com/p/django-multilingual
MIT License
0 stars 0 forks source link

Store translation data directly in master object's __dict__ #13

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Data for normal fields is kept in __dict__ of the model instance.  It might
be a good idea to do the same with translated content.  For example:

    class Category(models.Model):
        class Translation(multilingual.Translation):
            name = models.CharField(...)

    c = Category()

Currently c.name, c.name_en and c.name_pl are handled by properties that
keep the data in c._translation_cache as a dictionary of
CategoryTranslation instances.  The change would be to keep name_en,
name_pl and all the localized versions directly in c.__dict__, using the
CategoryTranslation model only when saving or loading the data.  It should
make a lot of things simpler AND faster.

Original issue reported on code.google.com by marcin.k...@gmail.com on 12 Feb 2007 at 10:49

GoogleCodeExporter commented 8 years ago

Original comment by marcin.k...@gmail.com on 19 Nov 2007 at 12:12