Search code examples
pythondjangolocalizationinternationalization

Gender problem in a django i18n translation


I need to solve a gender translation problem, and Django doesn't seem to have gettext contexts implemented yet...

I need to translate from english:

<p>Welcome, {{ username }}</p>

In two forms of spanish, one for each gender. If user is a male:

<p>Bienvenido, {{ username }}</p>

and if is a female:

<p>Bienvenida, {{ username }}</p>

note the difference (bienvenido/bienvenida)

Is there any way of getting this done?

Thanks,

H.


Solution

  • 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.