Django-oscar: Translatable models

Created on 16 May 2013  Â·  8Comments  Â·  Source: django-oscar/django-oscar

Currently, several parts of Oscar are not supporting switching languages on-the-fly. Categories are one example. Review is needed to find good solutions to that problem.

☼ Enhancement

Most helpful comment

(django-parler maintainer here) I've managed to include parler in an oscar website. A somewhat rough implementation is: https://gist.github.com/vdboor/46348490c7cd1a5b08f4 This doesn't properly support tab-switching (entering a new language means saving the existing first), but everything else worked with the translated fields. This implementation keeps the old title and description fields but leaves them alone.

All 8 comments

@codeinthehole @maikhoepfel what do you think about using https://github.com/deschler/django-modeltranslation?

I'm thinking about integrating django-modeltranslation. What do you think @solarissmoke @mvantellingen ?

Ok with me, but it would be nice if we could somehow make the dependency optional. Not sure whether that is possible.

I'm not sure if we should use https://github.com/deschler/django-modeltranslation or https://github.com/django-parler/django-parler.
To me django-parler looks like the right approach after reading https://django-parler.readthedocs.io/en/latest/background.html#database-schema, but django-modeltranslation seems to be easier to implement. Could you chime in, @vdboor?

I think having out-of-the-box support for django-modeltranslation would solve the problems for anybody who needs two or three languages. The database model isn't as clean as on django-parler but it's much more straightforward to work with.

Currently a bunch of the dashboard views need to be overriden to make django-modeltranslation to work.

This was discussed on the mailing list a few years back, but modeltranslation for sure.

I think we should use django-parler, because it adds the possibility to add languages without the need to create a migration. With django-modeltranslation you have to use a migration, everytime you decide to add a language. django-parler adds the possibility to give administrative users using the dashboard more power. It gives us flexibility. If an admin decides to add a language, we could make it possible that they could translate categories, emails, etc. to this language immediately.

(django-parler maintainer here) I've managed to include parler in an oscar website. A somewhat rough implementation is: https://gist.github.com/vdboor/46348490c7cd1a5b08f4 This doesn't properly support tab-switching (entering a new language means saving the existing first), but everything else worked with the translated fields. This implementation keeps the old title and description fields but leaves them alone.

Was this page helpful?
0 / 5 - 0 ratings