Django

Code

Ticket #5489: i18n.diff

File i18n.diff, 1.3 kB (added by msaelices, 8 months ago)
  • docs/i18n.txt

    old new  
    641641 
    642642(Note that this example makes the view available at ``/i18n/setlang/``.) 
    643643 
    644 The view expects to be called via the ``GET`` method, with a ``language`` 
    645 parameter set in the query string. If session support is enabled, the view 
     644The view expects to be called via the ``POST`` method, with a ``language`` 
     645parameter set in request. If session support is enabled, the view 
    646646saves the language choice in the user's session. Otherwise, it saves the 
    647647language choice in a ``django_language`` cookie. 
    648648 
    649649After setting the language choice, Django redirects the user, following this 
    650650algorithm: 
    651651 
    652     * Django looks for a ``next`` parameter in the query string
     652    * Django looks for a ``next`` parameter in ``POST`` request
    653653    * If that doesn't exist, or is empty, Django tries the URL in the 
    654654      ``Referer`` header. 
    655655    * If that's empty -- say, if a user's browser suppresses that header -- 
     
    657657 
    658658Here's example HTML template code:: 
    659659 
    660     <form action="/i18n/setlang/" method="get"> 
     660    <form action="/i18n/setlang/" method="post"> 
    661661    <input name="next" type="hidden" value="/next/page/" /> 
    662662    <select name="language"> 
    663663    {% for lang in LANGUAGES %}