How to correctly translate a message in Function __d

Hi!,

echo $this - > Html - > para(
        'small white-600 js-box',
        $this - > getDiscount() - > isValid() ?
        __d(
            'Discount.discount',
            'Discount.validLink', [
                'confirm' => $confirm,
                'link' => $pagesInstance - > getPage(WWWPages::validLink)['url'],
            ]
        ) :
        __d(
            'Discount.discount',
            'Discount.invalidLink', [
                'confirm' => $confirm,
                'link' => $pagesInstance - > getPage(WWWPages::invalidLink)['url'],
            ]
        )
)

Here I have such a piece of code that displays a translated message depending on whether the discount is valid or not. And so far it has worked correctly.

But I would like to extend this with another message, namely, if the rebate was not valid, then additionally there would be a check if this rebate has an “entitlement”. If it had it would display the current message (Discount.invalidLink), and if not have it would display a modified message. (all checking is already done on the JS side) now I need to put this message somehow in cakePHP.

The message has to be based on the current one i.e. Discount.invalidLink and its content would simply be modified. The first line in both would be the same, only the second line would be different.

Here is what such a message looks like:

msgid "Discount.invalidLink"
msgstr "Check your transaction {confirm}. "
"<span> Your invalid link <a href=\"{link}\" target=\"_blank\"></a> </span>"" 

I put the second line of the message in <span> and depending on whether there was an “entitlement” discount, only the first part would be displayed and if not the whole message.

And here I am wondering how to execute it should I create another function __d and try to pass .echo $this->Html->tag('span', text, ['class' => '.js inValid-link'] or is it enough to maybe pass this directly to the second function __d?

How could I do that?

Thanks in advance for your help!