[Zope3-dev] Issue 301

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Apr 27 10:51:06 EDT 2005


On Wednesday 27 April 2005 08:28, Dmitry Vasiliev wrote:
> I want to fix Issue 301 "Bug with i18n:name and i18n:translate on the same
> element" (http://www.zope.org/Collectors/Zope3-dev/301) but there are some
> open questions...

Great!

> Should '<span i18n:name="foo">bar</span>' pass '<span>bar</span>' to the
> msgid mapping or just 'bar'?

Wow, so this gets hairy and we need to get it right. Unfortunately, tests 
right now support both practices. So here are my observations:

<p i18n:translate="">
  This house is <em i18n:name="color" i18n:translate="">red</em>.
</p>

The case above should produce two message ids:

"This house is $color."
"red"

Note: The XML element containing i18n:name is *not* part of the second message 
id. Also, the <em> tag is not part of the outer message id.

So here is the way to think about this. The I18n name, as seen from the outer 
translation is the entire <em> element. However, the <em> element itself only 
sends its content out as a message id. 

Further, there need to be some rules deciding when the <em> tag should be 
omitted. I agree with Marius and Godefroid that it should only be omitted 
when either "tal:replace" or "tal:omit-tag" is specified. 

It thus follows:

- test_content_with_messageid_and_i18nname in test_talinterpreter.py is 
  correct.

- test36.html is incorrect.

- Marius' submitted test is correct.

> In the latter case which additional attributes should preserve the tag in
> the msgid mapping? 

All attributes inside the tag should be preserved, but nothing of the tag (I 
mean everything inside < >) should be submitted for translation.

> For example: 
>
> '<span i18n:name="foo" i18n:translate="">bar</span>' => 'bar' (translated)

This would be incorrect.

> but
>
> '<a href="url" i18n:name="foo" i18n:translate="">bar</a>' => '<a
> href="url">bar</a>' ('bar' translated)

This is correct.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-dev mailing list