brocaar/django-i18nurls — Issue #9: Reverse url to language switch view
Author: max-arnold
Created: 2012-02-24 08:34:39+00:00
State: open

Can you please give an example of how to reverse url to language switch view with the following scheme:

/en/page-slug/
/ru/page-slug/
/lang/page-slug/

urlpatterns = patterns('',
url(r'^$', homepage, name='homepage'),
url(r'^lang/(?P.*)$', LanguageView.as_view(), name='language'),)

urlpatterns += i18n_patterns('', url(r'^page-slug/', PageView.as_view(), name='page'))

Basically I want to put language link to the bottom of each page and make sure it contains remaining part of current url (page-slug), so the language view will be able to construct urls for each language pointing back to the page it was called from. Is there any helpers to get current request path without language prefix?