0

django trans is not working for me in this case:

{% blocktrans %} {{sign}} {% endblocktrans %}

the {{sign}} are coming from views.py and are Sunsigns like:

'Capricorn'
'Aquarius' 
'Pisces' 
'Aries' 
'Taurus' 
'Gemini' 
'Cancer'
'Leo' 
'Virgo' 
'Libra' 
'Scorpio' 
'Sagittarius'

I added into .po file all their translations and did compilemessages but it is just not translating it. what am I doing wrong?

doniyor
  • 36,596
  • 57
  • 175
  • 260

2 Answers2

1

blocktrans is for translating the text around a variable, but it won't translate the variable itself.

This answer can be helpful for you. More info in docs.

Community
  • 1
  • 1
cor
  • 3,323
  • 25
  • 46
  • thanks, I just did this in my models.py: ``_('Scorpio')`` for all of them in this way.. now it is working – doniyor Sep 11 '14 at 09:16
0

I just did the translation in models.py like this:

_('Capricorn')
_('Aquarius') 
_('Pisces') 
_('Aries') 
_('Taurus') 
_('Gemini') 
_('Cancer')
_('Leo') 
_('Virgo') 
_('Libra') 
_('Scorpio') 
_('Sagittarius')

and in template just

{{sign}}

and it is working.

doniyor
  • 36,596
  • 57
  • 175
  • 260