#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)
Change History (3)
by , 15 years ago
Attachment: | urllang.py added |
---|
comment:1 by , 15 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
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 , 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)
The middleware i have been using.