title: Can't change language in django
body: <p>This method should set the language with the language code:</p>
  
  <pre><code>def set_language(request):
      if request.method == 'POST':
          response = HttpResponseRedirect(reverse('root'))
          lang_code = request.POST.get('language', None)
          if lang_code and check_for_language(lang_code):
              if hasattr(request, 'session'):
                  request.session['django_language'] = lang_code
              else:
                  response.set_cookie(settings.LANGUAGE_COOKIE_NAME, lang_code)
          return response
      return render(request, 'profile/change_language.html')
  </code></pre>
  
  <p>The following form is in the html change_language.html</p>
  
  <pre><code>&lt;form action="{% url 'profile:language' %}" method="post"&gt;
              {% get_current_language as LANGUAGE_CODE %}
                  &lt;label for="new_lang"&gt;{% trans "Choose your language:" %}&lt;/label&gt;
                   &lt;fieldset&gt;
                       &lt;input type="radio" id="de" name="language" value="de" {% if LANGUAGE_CODE == 'de' %} checked {% endif %} &gt;
                       &lt;label for="de"&gt;German&lt;/label&gt;
  
                       &lt;input type="radio" id="uk" name="language" value="en" {% if LANGUAGE_CODE == 'en' %} checked {% endif %} &gt;
                       &lt;label for="en"&gt;English&lt;/label&gt;
                   &lt;/fieldset&gt;
  
                  {{ form.newlang }}
                  &lt;input type="submit" value="Change language"&gt;
                  {% csrf_token %}
  &lt;/form&gt;
  </code></pre>
  
  <p>In the settings.py I have the following relevant settings:</p>
  
  <pre><code>MIDDLEWARE_CLASSES = (
      'django.contrib.sessions.middleware.SessionMiddleware',
      'django.contrib.auth.middleware.AuthenticationMiddleware',
      'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
      'django.contrib.messages.middleware.MessageMiddleware',
      'django.middleware.clickjacking.XFrameOptionsMiddleware',
      'django.middleware.common.CommonMiddleware',
      'django.middleware.csrf.CsrfViewMiddleware',
      'django.middleware.locale.LocaleMiddleware',
      'django.middleware.security.SecurityMiddleware',
  )
  
  
  LANGUAGE_CODE = 'en'
  TIME_ZONE = 'CET'
  USE_I18N = True
  USE_L10N = True
  USE_TZ = True
  
  # Languages available
  LANGUAGES = (
      ('de', 'German'),
      ('en', 'English'),
  )
  </code></pre>
  
  <p>When I start the website, my language is German (I am in Germany). When I go to the change_language page and try to set the language from German to English, it won't change anything. Is there something that I maybe forgot?</p>