Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7917817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:16:48+00:00 2026-06-03T15:16:48+00:00

I know this is going to sound silly but I can’t find what’s wrong.

  • 0

I know this is going to sound silly but I can’t find what’s wrong.
I am using the built in views for user auth and logging in and loggin out respectively switches the language to the non default language for the current session.

I have two languages, setup according to documentation on Djangoproject site i.e. in locale folder and there are .mo files and everything. Fine.

I have a form based language switch that enables language switch for any user that posts to /i18n/setlang

So, my question is, how come it seems to “POST” to switch language when I do a logout or a login (which I guess are both POST’s as well).

Thanks for shedding any light possible on this.

EDIT: I should add that it never switches back. It only switches languages in one direction i.e. to the language that is not default.

EDIT2: Not that I think it will attract any more answers but here’s the code for my language switcher (it switches on the fly via jQuery. The problems is STILL that it goes to Deutch language and stays there whenever I logout (logout is handled by the logout view in Django).

<ul>            
    <li>
        <form name="setLangen" action="/i18n/setlang/" method="POST"><div style='display:none'><input type='hidden' name='csrfmiddlewaretoken' value='871Y71JyfG9WcieiKr8jjwe4j37IkIfq' /></div>
        <input name="next" type="hidden" value="/" />
        <input type="hidden" name="language" value="en" />
        <a href="#" onclick="document.setLangen.submit();return false;">English</a>
        </form>
    </li>

    <li>
        <form name="setLangde" action="/i18n/setlang/" method="POST"><div style='display:none'><input type='hidden' name='csrfmiddlewaretoken' value='871Y71JyfG9WcieiKr8jjwe4j37IkIfq' /></div>
        <input name="next" type="hidden" value="/" />
        <input type="hidden" name="language" value="de" />
        <a href="#" onclick="document.setLangde.submit();return false;">Deutch</a>
        </form>
    </li>

</ul>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T15:16:52+00:00Added an answer on June 3, 2026 at 3:16 pm

    OK. So here’s the answer. I thought I’d write it down since someone else CAN end up in this situation.

    The problem was that I had switched the order between django locale middleware and the middleware own my own that takes away the brwoser selected language. Need to keep your own interception before Django takes it over and sets the language to whatever the browser tells it to (which is a really weird default behavior in any case).

    Hope it helps someone.

    'myapp.middleware.ForceDefaultLanguageMiddleware',   # <-- BEFORE django locale!!
    'django.middleware.locale.LocaleMiddleware',
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this is going to sound silly but I cannot for the life
Ok I know this is going to sound weird but it is what the
I know this question is going to sound very stupid but here goes nonetheless.
I know I am going to sound very noobish for asking this question BUT
This is going to sound super hackish but does anyone know of a way
I know this is going to sound like a dumb question, but as I'm
I know this may sound silly, but I'd like to put a version in
Okay, I know this is going to sound like homework; but here goes any
Can anybody help with this code I just don't know where I am going
I know this is possible in Perl, but I was wondering if this can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.