Issue trying to change language from Django template

前端 未结 7 2161
悲&欢浪女
悲&欢浪女 2020-12-01 06:46

I need to include two buttons or links to allow users change language between English and Spanish. I\'ve read the docs and tried this:

7条回答
  •  误落风尘
    2020-12-01 07:38

    If in your current system you have only 2 languages then simply use like below:

    {% ifequal LANGUAGE_CODE "en" %}
           Spanish
    {% else %}
           English
    {% endifequal %}
    

    No need of a form, url and submit etc. It worked for me.

提交回复
热议问题