[SOLVED] How to translate text when there is a variable inside

I am struggling with translating a text in which a variable is inside. I am using sprint_f() for it:
 

$email = testemail@live.nl;
notices::add('success', language::translate('email_confirmation', sprintf('A link is sent to %s',$email)));

This is how it is stored in translations:

email_confirmation -> A link is sent to testemail@live.nl

I was expecting that the translations looked like:

A link is sent to %s

How can i achieve this?

Hello,
you can try this:

$email = 'testemail@live.nl';
notices::add('success', sprintf(language::translate('email_confirmation', 'A link is sent to %s'),$email));

Found the correct one that works:

$email = $_POST['email'];
notices::add('success', sprintf(language::translate('email_confirmation_sent1', 'A link is sent to %s'),$email));

The translation function should be inside the sprint_f() function!

tim

I like the use of strtr(). And even for inserting HTML.
https://www.php.net/manual/en/function.strtr.php

echo strtr(language::translate('text_hello_user', 'Hello %user'), [
  '%user' => 'John',
]);
This thread has been closed due to long inactivity. Posting to it is not possible.
View code on GitHub