ho qualche codice di modello che assomiglia a:Come traduco l'uscita di un filtro in Django
<input type='submit' value='{{ need.satisfied|yesno:"Resend this document now,Send this document now" }}' />
mi piacerebbe essere in grado di tradurre, ma che sembra essere difficile da realizzare.
http://code.djangoproject.com/ticket/3804 menzioni
{{ _("Some String") }}
che sembra funzionare per le stringhe letterali, ma quando viene utilizzato come
{{ _(Variable) }}
dà l'errore
Variables and attributes may not begin with underscores: '_'
Quindi, come si fa a farlo?
Oh sì, ho provato a fare:
'{% if blah %}{% trans "Resend..." %}{% else %}{% trans "Send..." %}{% endif %}'
che funziona, ma sembra così brutto che non voglio. Sicuramente con Django c'è qualche più elegante modo per farlo .....
sembra un | filtro trans sarebbe in ordine, ma che è stato abbattuto come un non-problema con http://code.djangoproject.com/ticket/3804
Grazie, questo è esattamente quello che stavo cercando. – boatcoder