malthe / chameleon

Fast HTML/XML template engine for Python
https://chameleon.readthedocs.io
Other
177 stars 64 forks source link

Result of use-macro is placed in the wrong position, when using i18n:translate #419

Open pgrunewald opened 7 months ago

pgrunewald commented 7 months ago

Consider the following HTML snippet:

<tal:fancy-link metal:define-macro="fancy-link">
  <a href="#">
    Fancy link    
  </a>
</tal:fancy-link>

<tal:something i18n:translate="text_with_link">
  Now follows a fancy link: <metal:fancy-link i18n:name="obj_link" use-macro="template/macros/fancy-link" />
</tal:something>

Expected output:

Now follows a fancy link: Fancy link

Current output:

Fancy link Now follows a fancy link:

Noteworthy, when I edit the HTML by removing i18n:translate and i18n:name it places the link the correct position. This does not help, because I want to place the link depending on the translation.

Tested with Chameleon version: 3.9.1