views:

50

answers:

1

Hello guys,

I'm using the i18n feature of Django. I have noticed that even though I have translated everything on django.po and compiled it to django.mo, some parts of my website are always appearing in english instead of the selected language (portuguese). For example:

I have a page with these fields:

  1. Tag
  2. Name
  3. Matches Played
  4. Created On

The translation would be:

  1. Tag
  2. Nome
  3. Partidas Jogadas
  4. Criado em

Yet, what I get is:

  1. Tag
  2. Nome
  3. Matches Played
  4. Created On

The code is exactly like this:

<tr>
 <th>{% trans 'Tag' %}:</th>
 <td>{{ clan.tag }}.</td>
</tr>
<tr>
 <th>{% trans 'Name' %}:</th>
 <td>{{ clan.name }}.</td>
</tr>
<tr>
 <th>{% trans 'Matches Played' %}:</th>
 <td>{{ clan.ammountMatchesPlayed }}.</td>
</tr>
<tr>
 <th>{% trans 'Created On' %}:</th>
 <td>{{ clan.created|date:"d/m/Y" }}.</td>
</tr>

On django.po I have:

#: templates/clans/detail.html:45
msgid "Tag"
msgstr "Tag"

#: templates/clans/detail.html:49
msgid "Name"
msgstr "Nome"

#: templates/accounts/detail.html:111
msgid "Matches Played"
msgstr "Partidas Jogadas"

#: templates/accounts/detail.html:115 templates/clans/detail.html:53
msgid "Created On"
msgstr "Criado Em"

And I have compiled it with django-admin compilemessages.

Any idea? How can I debug this? Thanks

A: 

Hi,

I suspect your translations are not being read. I had a similar problem and the reason why some appear and some dont is that the ones that appear are coming from the translations for django itself.

Where are your translations located? do you have a locale directory in your project or in each installed application? Does your project have a settings.py file? Are you loading the {% load i18n %} templatetags so that you can use trans?

Give me more details and maybe I can help you with that :)

filias