Skip to content

The target_language specified via i18n:target in a macro is not passed to the filled slot. #439

@ale-rt

Description

@ale-rt

I have this template that defines a macro with a slot:

<html metal:define-macro="main" i18n:target="string:fr">
    <head>
        <title i18n:translate="">Hello world!</title>
    </head>
    <body>
        <metal:content define-slot="content">
            <h1 i18n:translate="">Hello world!</h1>
        </metal:content>
    </body>
</html>

This second template that uses that macro and customizes the slot:

<html metal:use-macro="load('332-master-i18n-target.pt').macros['main']">
    <metal:slot fill-slot="content">
        <h1 i18n:translate="">Hello world!</h1>
        <p>Ciao!</p>
    </metal:slot>
</html>

I expect the output to be like:

<html>
    <head>
        <title>Hello world! ('Hello world!' translation into 'fr')</title>
    </head>
    <body>

        <h1>Hello world! ('Hello world!' translation into 'fr')</h1>
        <p>Ciao!</p>

    </body>
</html>

Instead it is like:

<html>
    <head>
        <title>Hello world! ('Hello world!' translation into 'fr')</title>
    </head>
    <body>

        <h1>Hello world! ('Hello world!' translation into 'use')</h1>
        <p>Ciao!</p>

    </body>
</html>

As you can see <title> is translated, but the <h1> is not.

It seems like the translation target is not passed to the second template.

Is this the expected behavior?

Note that until version 4.2.0 this was working as I was expecting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions