Open Redjam opened 2 years ago
Hey @Redjam,
What would the use case for this be?
@zerolab we have a post type that we are not going to translate. It will only be accessible in the primary language. Because aliases are created automatically, the "translated" versions appear in the menu. Editors need to delete these pages one by one in order to keep the menu clean.
Sometimes we have blogs that are not translated. Articles are only written in the main language. In this case, same issue: aliases make content available in the other languages whereas it shouldn't (because pages are not translated).
Hope my explanation is clear.
This makes sense, thank you for sharing.
We do something along the lines of this for synced/manual translations - https://www.wagtail-localize.org/how-to/installation/#disabling-the-default-translation-mode where you can set a localize_default_translation_mode
attribute on the page model.
I can see this being useful, but we do want to be careful. Say you have ParentPage
and ChildPage
. You say you don't want ParentPage
to be translated, but ChildPage
can be translated. It also happens that ChildPage
can only be created under ParentPage
. When you have a locale following another, aliases get created automatically, so if we were to exclude a parent page because of an attribute, or whatever it is, what do we do with the child page? We can only create an alias if its parents are created first.
Granted, you will not do this in your code, but we cannot cover all use cases. So given just that one case above, why not flip this around on the implementer side:
after_create_page
with your custom logic, calling the alias creation bit where relevant. https://github.com/wagtail/wagtail-localize/blob/main/wagtail_localize/synctree.py#L198-L219 is how localize is doing it
Hi there,
Correct me if I'm wrong but it seems to be not possible to create a model that inherit from Page model and that is not translatable.
I think a param should be added to avoid creating aliases for a model that won't be translated.