wagtail / wagtailtrans

A Wagtail add-on for supporting multilingual sites
http://wagtailtrans.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
104 stars 60 forks source link

Automatically set the slug for homepages #137

Open mikedingjan opened 5 years ago

mikedingjan commented 5 years ago

At the moment we kinda assume the user will use the language code as a slug when creating an homepage https://github.com/LUKKIEN/wagtailtrans/blob/master/src/wagtailtrans/models.py#L273. It would be nice to have an setting which will enforce the homepage to be the language code, since this will be 99% of the time the case since this also sets the language from the request path properly.

I think it should nice when the direct children of the the TranslatableSiteRootPage get this slug automatically, so copied pages will have the right slug as well and not homepage-languagecode, this should be easy to check in a save() method on the model.

jompu commented 5 years ago

Further more, it was not very intuitive to understand that you have to set slug as language code for this to work. Also I was confused by i18n_patterns until I found #67 and removed it.

mikedingjan commented 5 years ago

I get that, only this is one of the possible strategies you can use.. We've implemented this without i18n_patterns to keep it flexible, all pages, know their language object, which will get activated in the serve() method.