I try to translate string, which is in mark_safe() function:
from django.utils.translation import ugettext as ug
...
mark_safe('<div style="text-align:center"><a href="/calendar/" target="_blank" onclick="return open_popup(this); return false">%s</a></div>' % ug(u'show full calendar'))
Unfortunately, when I run run django-admin.py makemessages -l pl, it doesn't include this string in .po file. I have to edit it manually, write this line and then it works fine (the string is translated). It happens each time I run makemessages.
Import it and use as underscore instead:
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext_lazy as ug
_('this is seen')
ug('this is not')
I think the problem was with mark_safe and ug:
from django.utils.translation import ugettext as ug
...
mark_safe('<div style="text-align:center"><a href="/calendar/" target="_blank" onclick="return open_popup(this); return false">%s</a></div>' % ug(u'show full calendar'))
should be:
from django.utils.translation import ugettext as ug
...
mark_safe('<div style="text-align:center"><a href="/calendar/" target="_blank" onclick="return open_popup(this); return false">%s</a></div>') % ug(u'show full calendar')
Notice the brackets.