[Answered ]-Django: blocktrans entry is not being translated

2πŸ‘

βœ…

It’s not translated because {{house_type}} will have the value of house_post.house_type.name.

The blocktrans actually does nothing in your code. You would need it if you want to add a translatable text to the sentence. Ex:

  {% blocktrans with house_type=house_post.house_type.name trimmed %}
    {{house_type}} Translate this part
  {% endblocktrans %}

If you want to have a translated variable, you have to pass the translations to house_post.house_type.name.

πŸ‘€ferrangb

0πŸ‘

The content of your blocktrans is most likely the content of {{house_type}}. Not sure where it comes from, but this is where you have to translate it. Don’t forget to insert something like

from django.utils.translation import ugettext_lazy as _

to header of your py-files.

πŸ‘€frlan

Leave a comment