double translation happens with python message ids

Bug #101389 reported by Martijn Faassen
6
Affects Status Importance Assigned to Milestone
Silva
Won't Fix
Medium
Wim Boucquaert

Bug Description

If i18n:translate="" is in place, but a Python-level message id is returned,
translation right now *happens twice*.

First, the page template engine will str() (or unicode()) the message id,
causing the right translation to happen.

However, after this, an i18n:translate="" in the page template will attempt to
look up that translated string *again*, this time in the domain of the page
template. This will normally fail (as the string cannot be found), and the
default string is returned.

So, matters work by accident, but are not as efficient as they should be.

Revision history for this message
Andy Altepeter (aaltepet) wrote :

Could an example be provided for this? Or an explanation of how to test this?

Changed in silva:
status: New → Incomplete
Revision history for this message
Eric Casteleijn (thisfred) wrote :

This mostly happens when a page template gets a msgid back from a python script or actual code, instead of a string, and then puts that msgid in a tag with the i18n:translate attribute. I wonder how often this happens, I'm guessing it's not very common, but one area to explore might be the status messages, since they are most commonly created in scripts (as msgids) and then shown in page templates. It would be good to ensure that these are not translated again. There might be other cases where this happens, but I'm not sure how easy they are to hunt down.

Revision history for this message
Kit Blake (kitblake) wrote :

Changing state to Confirmed so Launchpad doesn't expire this 'Incomplete' bug in 45 days.

Changed in silva:
status: Incomplete → Confirmed
Changed in silva:
assignee: nobody → aaltepet
Revision history for this message
Andy Altepeter (aaltepet) wrote :

I still have no idea how to setup a test for this, so I'm passing this on.

Changed in silva:
assignee: aaltepet → thisfred
Changed in silva:
assignee: thisfred → wim-boucquaert
Revision history for this message
Sylvain Viollon (thefunny) wrote :

1. I believe this is not a bug, because it doesn't explain where changes should be made. This is just an explication for people who don't undestand what they are doing.

2. All the templates (for SMI) have been thrown away in order to create a single AJAX interface, where this problem doesn't exist anymore: strings are either properly translated directly in the template (there are no tal:content i18n:translate on the same tag), either they are directly translated and not rendered via template.

Changed in silva:
milestone: none → 3.0
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.