wagtailtrans icon indicating copy to clipboard operation
wagtailtrans copied to clipboard

(Question/Feature Request) Allow default language to not have prepended slug

Open bufke opened this issue 5 years ago • 6 comments

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.

bufke avatar Oct 23 '19 18:10 bufke

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.

jjanssen avatar Dec 05 '19 10:12 jjanssen

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.

kaedroho avatar Dec 05 '19 15:12 kaedroho

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.

bufke avatar Jan 06 '20 23:01 bufke

Is there any workaround for this? I'd really like to have this functionality

matiasmm avatar May 03 '20 23:05 matiasmm

It will be really very useful.

George-on avatar Jun 20 '20 01:06 George-on

+1

jkevingutierrez avatar Aug 21 '20 19:08 jkevingutierrez