Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#13450 closed (wontfix)

Can django's i18n internationalization middleware offer language selection by URL?

Reported by: benoitcsirois Owned by: nobody
Component: Internationalization Version: 1.1
Severity: Keywords: i18n internationalization seo languages urls
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Django's current internationalization framework allows only the project's default language to be indexed by search engines, because a single URL is only indexed in one language in the search engine.

Would it be possible to implement a www.example.com/LANG/app type of URL handling in django's internationalization framework?

I have been using something similar, which someone published (forget where I found it, see attached file for middleware), but it breaks django's reverse url lookup, unless I specify urls with a (?P<lang>(\w\w)) at the beginning... thus resulting in a useless "lang" parameter passed-on to views.

Can a simpler, more integrated solution be implemented?

Attachments (1)

urllang.py (1.8 KB ) - added by benoitcsirois 15 years ago.
The middleware i have been using.

Download all attachments as: .zip

Change History (3)

by benoitcsirois, 15 years ago

Attachment: urllang.py added

The middleware i have been using.

comment:1 by Russell Keith-Magee, 15 years ago

Resolution: wontfix
Status: newclosed

I'm fairly certain what you describe can be achieved by setting request.urlconf in the middleware.

As for adding this to Django; my inclination is that this probably isn't suitable for core. It strikes me as a design pattern that requires a lot more infrastructure than just a middleware - it would also require language-sensitive models etc, which is the domain of external projects like django-rosetta.

However, this isn't a particularly strongly held position; if you want to make your case for the inclusion of a feature like this, feel free to advocate for it on django-developers (preferably after the 1.2 release is out the door, so we can give it the proper attention).

comment:2 by Jannis Leidel, 15 years ago

FWIW, you can easily add this feature to your site with the third party app django-localeurl.

(Btw, this is a little bit of a duplicate of #9333)

Note: See TracTickets for help on using tickets.
Back to Top