beware: make-messages is file extension sensitive

3 views
Skip to first unread message

omat

unread,
Apr 30, 2008, 8:14:15 AM4/30/08
to Django users
Hi,

I was wondering why my email templates were not getting translated. It
took me hours before I check the bin/make-messages.py and figure out
that only some files, depending on their extensions, are translated.

I thought make-messages were working in more django-aware manner and
inspects the projects (settings, models, views, etc) to find related
files and extract text to be translated.

The way it actually is is more simple and straight-forward, so it is
quite ok. But dependency on file extension (especially for templates)
was something I wouldn't expect.


Regards,
omat

omat

unread,
Apr 30, 2008, 8:48:27 AM4/30/08
to Django users
And ...

If you would like to add a few words to the translation, like menu
items, etc. without going into views and database, do not put them
into the .po file directly. They will be commented out each time you
run make-messages. Also there can be duplications that will result in
errors.

More maintainable (though hacky) way is to create a template file such
as translation.html and put the strings to be translated into that
file such as:

{% load i18n %}
{% trans "Home page" %}
{% trans "Continue" %}

afro

unread,
May 8, 2008, 4:36:46 AM5/8/08
to Django users
Hi Omar,

Your message saved my day, I didn't think it would be because of such
a simple reason that make-messages.py omits my template files. I
actually just opened make-messages.py and changed '.html' to '.htm' in
two places, and that solved it. I just have to watch out the next time
I do an update, I guess.

Cheers,
Ulas

On Apr 30, 2:48 pm, omat <o...@gezgin.com> wrote:
> And ...
>
> If you would like to add a few words to the translation, like menu
> items, etc. without going into views and database, donotput them
> into the .po file directly. They will be commented out each time you
> run make-messages. Also there can be duplications that will result in
> errors.
>
> More maintainable (though hacky) way is to create a template file such
> as translation.html and put the strings to betranslatedinto that
> file such as:
>
> {% load i18n %}
> {% trans "Home page" %}
> {% trans "Continue" %}
>
> On Apr 30, 3:14 pm, omat <o...@gezgin.com> wrote:
>
> > Hi,
>
> > I was wondering why my emailtemplateswerenotgettingtranslated. It
> > took me hours before I check the bin/make-messages.py and figure out
> > that only some files, depending on their extensions, aretranslated.
>
> > I thought make-messageswereworking in more django-aware manner and
Reply all
Reply to author
Forward
0 new messages