Django: How to force translation into a given language inside a template?

后端 未结 4 470
挽巷
挽巷 2021-01-01 00:24

In a Django template, I need to transanlate some strings to a specific language (different from current one).

I would need something like this:

{% ta         


        
4条回答
  •  有刺的猬
    2021-01-01 01:13

    From Django version 1.6, there is a language template tag so you can simply pass the desired language code:

    {% language "de" %}my block to translate{% endlanguage %}
    

提交回复
热议问题