Reputation: 394
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' }}
Upvotes: 3
Views: 1347
Reputation: 476719
You can store the translated string in a variable, like:
{% trans 'TRANSLATED STRING' as transl %}
{{ value|default_if_none:transl }}
It however might make sense to define a custom template filter [Django-doc] here.
Upvotes: 9