Gender problem in a django i18n translation Gender problem in a django i18n translation django django

Gender problem in a django i18n translation


The way that I've solved this is:

{% if profile.male %}{% blocktrans with profile.name as male %}Welcome, {{ male }}{% endblocktrans %}{% else %}{% blocktrans with profile.name as female %}Welcome, {{ female }}{% endblocktrans %}{% endif %}


Django is just Python so you can use the Python gettext bindings directly if you need to, I don't see any reason you couldn't write a {% gender_trans [gender] %} tag.


While waiting for contexts to be supported, an easy alternative would be to slightly change the Spanish sentence and use a greeting that does not vary according to a person's gender. For example, you could use "hola", or some other equivalent term.