Opened 9 years ago

Closed 9 years ago

#25013 closed Uncategorized (needsinfo)

Using prefixes for language, the html template code example to switch languages does not work for me.

Reported by: Wim Feijen Owned by: nobody
Component: Internationalization Version: 1.8
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When using i18n_patterns, a prefix is placed for a language. In my example, I am using 'nl/' and 'en/'.

This does not work well with the example html template code example given
https://docs.djangoproject.com/en/1.8/topics/i18n/translation/#module-django.conf.urls.i18n

after changing the language from Dutch to English, I am being redirected to the English page again.

I believe it is the same problem as described here:
http://stackoverflow.com/questions/25548926/change-language-and-its-url-in-django

Easier for us now seems to use jquery to modify the url in order to switch languages.

It might be that I am doing something wrong. I am quite capable of doing that. Cheers!

Change History (4)

comment:1 by Tim Graham, 9 years ago

There's a warning for the set_language() docs that says: "Make sure that you don’t include the above URL within i18n_patterns() - it needs to be language-independent itself to work correctly." Did you follow that advice?

comment:2 by Wim Feijen, 9 years ago

Yes, I'm using:

urlpatterns = patterns("",
    url(r'^i18n/', include('django.conf.urls.i18n')),
)

urlpatterns += i18n_patterns('',
    ("^admin/", include(admin.site.urls)),
    # etcetera

comment:3 by Claude Paroz, 9 years ago

An example project would be nice.

comment:4 by Tim Graham, 9 years ago

Component: UncategorizedInternationalization
Resolution: needsinfo
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top