Can't get i18n/setLang to match any urls

254 views
Skip to first unread message

Shawn H

unread,
May 14, 2014, 5:45:43 PM5/14/14
to django...@googlegroups.com
I'm beginning the process of adding some translations to one public page, and I can't get my setLang url to match, getting a 404 instead. I've got USE_I18N = True in my settings.  I've got 'django.core.context_processors.i18n', in my TEMPLATE_CONTEXT_PROCESSORS.  Copied the directly from the docs, version 1.6

My urls.py

from django.conf.urls import patterns, include, url
from sdcgis import settings

urlpatterns = patterns('',
    
    #index
    url('^sdc/home/',include('sdc_home.urls', namespace='sdc_home')),
    
    #user language
    (r'^i18n/', include('django.conf.urls.i18n')),
 #I tried url(r'^i18n/', include('django.conf.urls.i18n')), too, with no luck
 ...

 I'm making an jQuery post:

var data = {'name':'language', 'value':'en-us'};
 
$.post('/i18n/setLang/', data, function() {
});

My browser says I'm requesting via POST http://localhost/i18n/setLang/, with form data of name: language and value:en-us.  I get 404.  What am I missing?

Kelvin Wong

unread,
May 17, 2014, 2:04:45 AM5/17/14
to django...@googlegroups.com
The L in setLang should be setlang as in the L is lowercase

From my Django log "POST /i18n/setlang/ HTTP/1.1" 302 0

K

Shawn H

unread,
May 17, 2014, 10:36:20 AM5/17/14
to django...@googlegroups.com
Grrrr.  I read the docs, and I SWEAR it had the "l" as a capital.  It's always the simplest things.  Thank you!
Reply all
Reply to author
Forward
0 new messages