Opened 14 years ago
Closed 13 years ago
#404 closed defect (fixed)
i18n:msg removes some text under certain conditions
Reported by: | Martin Scharrer <martin@…> | Owned by: | cmlenz |
---|---|---|---|
Priority: | critical | Milestone: | 0.7 |
Component: | Template processing | Version: | 0.6 |
Keywords: | i18n:msg text removed | Cc: | hoff.st@… |
Description
I found the following behavior when I was working on th:WatchlistPlugin and had a closer look on it.
When using the i18n:msg attribute then under certain conditions parts of the text content is missing in the final rendered XML output.
The conditions seem to be:
- i18n:msg argument with two variables, like i18n:msg="first,second"
- The first argument IS NOT inside a tag
- The second argument IS inside a tag
- After both arguments there is the following content:
- A text NOT inside a tag
- A text INSIDE a tag
- A text NOT inside a tag
Then the text 4a is REMOVED from the rendered XML/XHTML output.
Example:
<p class="incorrect" i18n:msg="first,second"> $first <span>$second</span> REMOVED <span>Inside a tag</span> Outside a tag </p>
results in (with first='FIRST', second='SECOND'):
<p class="incorrect">FIRST <span>SECOND</span><span>Inside a tag</span> Outside a tag</p>
If e.g. the first argument is also inside a tag the rendered output is correct. Also when the i18n:msg argument is dropped it works correctly.
I wrote a demonstration script and attached it together with the output I get. It shows several slightly different variations to demonstrate the above conditions.
Note: This was tested with Genshi 0.6 stable and 0.7dev-r1134 and Babel 0.9.5.
Attachments (2)
Change History (5)
Changed 14 years ago by Martin Scharrer <martin@…>
Changed 14 years ago by Martin Scharrer <martin@…>
Output of demonstration script attachment:i18n-msg_removes_text.py
comment:1 Changed 14 years ago by Martin Scharrer <martin@…>
- Component changed from General to Template processing
comment:2 Changed 13 years ago by hodgestar
Thank you for your excellent test case! I seems the way events were stored inside the translation parsing code was a bit messed up. The first argument outside the tag was broken up into three events (TEXT, EXPR, TEXT) and the parsing code expected there to be exactly one event on between tags or on either side of a tag. There was a special case to handle a tag with only TEXT and EXPR events inside.
I've changed the translation code to handle multiple events around and between tags. Committed in r1177.
comment:3 Changed 13 years ago by hodgestar
- Resolution set to fixed
- Status changed from new to closed
Merged into 0.6.x in r1178.
Demonstration script