[Django]-Is it possible to have a multi-lingual django CMS site without using language codes in the URL?

5👍

At present, what you require is not possible.

If you do without the code (it, en or whatever) in the URL, by changing the URL pattern registration from:

urlpatterns = i18n_patterns('',
    url(r'^', include('cms.urls')),
)

to

 urlpatterns = patterns('',
    url(r'^', include('cms.urls')),
)

you will also lose the access to multiple language versions of the content.

Doing this is only suitable for a single-language site.

See the django CMS internationalisation documentation for more.

It’s true that the CMS also takes note of the session and the cookie, but these actually redirect to the correct language code anyway – lose that, and you will never get redirected to the desired language.

Unfortunately, you will have to choose between a single-language site or accepting URLs that contain language slugs. You can of course share URLs that don’t have the language slug, in which case the system will fall back through various clues to find the desired language – and then will of course, redirect to a URL containing the code.

As for why, a basic principle for a content management system that a public URL of this kind should reliably point to the same content, and not potentially unexpected content.

Maybe there is a case for allowing for different behaviour, but at the moment, that is how things stand.

Leave a comment