First time here? Check out the FAQ!
1

Does jinja2_makemessages miss some messages?!

According to this question jinja2_makemessages is supposed to work fine with templates. But in my latest update from the Github repo I'm noticing that some strings are being skipped. For example the sort by button labels on questions page: 'by date', 'by activity', 'by answers', 'by votes'.

Am I doing something wrong?! I'm just doing the same thing I used to do before:

python /path/to/manage.py jinja2_makemessages -l xx -e html,py,txt
Basel Shishani's avatar
197
Basel Shishani
asked 2012-04-20 00:10:04 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

1

It does miss those messages when used in a specific way in the jinja2 templates. To work around this problem, the messages are added to file askbot/const/messages.py there is only about a dozen of messages like these.

At some point I've changed "votes" -> "by votes" etc, to make them different from simply "votes" (sometimes you need both in the language files) and forgot to update the askbot/const/messages.py.

So now they are not missed.

Evgeny's avatar
13.2k
Evgeny
answered 2012-04-20 03:35:23 -0500
edit flag offensive 0 remove flag delete link

Comments

Evgeny, thanks for the answer and I really appreciate the time you're devoting to this. May I ask, is this some dormant bug in (jinja2_)makemessage to be addressed at some point in the future, or is it a known/understood inherent issue in the way makemessages - gettext - templates interact together. If you have a pointer on this it will do me.

Basel Shishani's avatar Basel Shishani (2012-04-20 04:07:41 -0500) edit

Maybe there is a fix to this, but I could not find it easily, the issue is with {{ gettext('somemessage') }} type of calls in the template. Possibly some regexes in the jinja2_makemessages could be fixed.

Evgeny's avatar Evgeny (2012-04-20 04:14:43 -0500) edit

And just a small correction on askbot/const/message_keys.py

Basel Shishani's avatar Basel Shishani (2012-04-20 09:02:23 -0500) edit
add a comment see more comments
0

I have the same issue, posted here, and I work around this by deleting, inside .po file, all #~ that actually comment out my useful, translated pairs. May that would work for you two.

zaf's avatar
512
zaf
answered 2012-04-21 07:48:29 -0500
edit flag offensive 0 remove flag delete link

Comments

I think that was accidental for you. If you run makemessages again it will comment out your translations once more. The workaround explained by Evgeny works fine for now. The issue he mentioned is explained in detail in the jinja2_makemessages module doc.

Basel Shishani's avatar Basel Shishani (2012-04-21 20:30:22 -0500) edit
add a comment see more comments