How can I use a translated string inside a template for default_if_none
?
Usually you would use something like this: {% trans 'TRANSLATED STRING' %}
Example
{{ value|default_if_none:'TRANSLATED STRING' }}
You can store the translated string in a variable, like:
{% trans 'TRANSLATED STRING' %}
{{ value|default_if_none: }}
It however might make sense to define a custom template filter [Django-doc] here.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.