Well as far I can test, Django i18n does supports fall-back 'xx-YY' to 'xx'
then to default ('en' in my case) but only for 'Accept-Language' user agent
header. It does not do same for URL language switch.
Here is the solution I could come up with:
from django.views.generic import RedirectViewfrom django.conf import settings...
urlpatterns += patterns('',
url(r'^(?P<lang>[a-z]{2})-[A-Za-z]{2}/(?P<path>.*)$',
RedirectView.as_view(url='/%(lang)s/%(path)s',query_string=True)),
url(r'^[a-z]{2}/(?P<path>.*)$',
RedirectView.as_view(url='/{}/%(path)s'.format(settings.LANGUAGE_CODE),query_string=True)),)
- Any xx-YY not handled by i18n pattern redirected to xx
- Any xx not handled by i18n pattern redirected to default language set
using LANGUAGE_CODE.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/a14b0173-f665-401c-a665-e25ef9ddf976%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.