I want to use django-oscar
for building an web shop and this shop will provide two main languages.
Oscar's
translations do very well with regular fields like View chart
or Add to chart
, but does not support custom elements e.g. Categories
or Product's
Titles
.
I want have translated:
Category
Product.Title
Product.Description
I've figured out two approaches:
Approach one - modify django-oscar
templates
I can create custom set of tranlsations according to oscar's translation doc.
And then fill proper django.po
file with translated categories and product's titles.
Unfortunately I will have to overwrite some templates, because they don't use trans
templatetag by default. E.g. I would change.
<a href="{{ category.get_absolute_url }}">{{ category.name }}</a>
to
<a href="{{ category.get_absolute_url }}">{% trans category.name %}</a>
In this oscar's template.
Main problem with this approach is need for overwriting templates, updating django.po
as well as compiling it with every new entry to translate.
Approach two - use django-modeltranslation
Using this plugin.
Question
Does I miss some build in django-oscar's
feature, or I have to use one of above approaches?
Using django-modeltranslation
was a good idea.
Even updating dashboard according to customization instructions from oscar's
docs and ModelForm description from modeltranslation's
docs done the job well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With