wagtailtrans
wagtailtrans copied to clipboard
(Question/Feature Request) Allow default language to not have prepended slug
Is there any current way of providing a url structure like this? Assume English is default
/ (English) /fr/ /es/ etc
This conflicts with Wagtail's tree structure. Typically wagtailtrans's Translatable site root page would occupy "/" and English would have a slug such as /en/
This creates hardship migrating a site in one language to many as all the previous links change. Sometimes it's not desired to have the "en" slug for the default language.
How to reproduce?
- Create a translatable site root page as noted in documentation
- Create a home page under the translatable root page
We see the homepage requires a slug which makes it something like /en/
Other info
It's possible I could work on this feature if it was desired upstream. I'm waiting for direction from a client.
Potential work around
One could just make two sites. One for the default language and one for everything else. It might involve minor trickery as both sites may be on the same domain.
Hi @bufke
We have had some offline discussion about this and we'd be happy to have this available: it makes total sense. Perhaps with a configurable setting to which you can opt-in to. That way we don't change the current behaviour directly and maintain backwards-compatibility.
I know we've neglected to answer your question earlier but would you still be willing to make a PR for this? Otherwise it is open for grabs.
The way Django's i18n_patterns
solves this is to prefix all URLs that have content, and when someone makes a request that isn't prefixed they get redirected to the prefixed version based on the language configured in their browser.
No worries, it took a long time for our client to decide anyway and they went with moving the en site to a path. Unfortunately that means I won't be able to make the PR unless we get another client who wants it.
Is there any workaround for this? I'd really like to have this functionality
It will be really very useful.
+1