This makes sense as pages are stored in a tree and other objects (like snippets are not) and how it's solved now.
So I suggest that this pull request should focus on the first improvement (Create a own TranslatablePage model with just inheriting from Page and TranslatablePageMixin).
Therefore we need to make the TranslatablePage model pluggable, just like the WAGTAILIMAGES_IMAGE_MODEL in wagtail with a setting. Then we could use this mechanism to use own Page models with the Mixin.
Therefore I would rename the mixin to TranslatablePageMixin so it's more clear what it is doing.
The second step is to make snippets and other objects translatable, but that could be a next step feature in another pull request.
This is a continuation of the abandoned pull request #155
I'll add documentation and other fixes to this branch. We are testing this in a project now as well.
Things to do:
TranslatablePage
model configurable with a setting and use that in wagtailtransTranslatablePageMixin
and how to make your own translatable typesUpdate and explanation: We've been playing around a bit and this pull request can be a good start for two wagtailtrans improvements:
TranslatablePage
model which just inherits fromPage
andTranslatable (Page) Mixin
But the PR implementation is not polished enough to implement both correctly.
The current setup of wagtailtrans is depending heavily on TranslatablePage queries:
This makes sense as pages are stored in a tree and other objects (like snippets are not) and how it's solved now.
So I suggest that this pull request should focus on the first improvement (Create a own
TranslatablePage
model with just inheriting fromPage
andTranslatablePageMixin
).Therefore we need to make the
TranslatablePage
model pluggable, just like theWAGTAILIMAGES_IMAGE_MODEL
in wagtail with a setting. Then we could use this mechanism to use own Page models with the Mixin.Therefore I would rename the mixin to
TranslatablePageMixin
so it's more clear what it is doing.The second step is to make snippets and other objects translatable, but that could be a next step feature in another pull request.
@mikedingjan Your thoughts on this?