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

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

Open bufke opened 4 years ago

bufke commented 4 years ago

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?

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.

jjanssen commented 4 years ago

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.

kaedroho commented 4 years ago

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.

bufke commented 4 years ago

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.

matiasmm commented 4 years ago

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

George-on commented 4 years ago

It will be really very useful.

jkevingutierrez commented 4 years ago

+1