Using translations with variables?

Hi there,

I have a translation where a Link is included. So my first thought was something like this:

'translations' => [
    'text' => 'Check our <a href="' . page('imprint')->url() . '">imprint</a>',
    'subject' => 'Subject'
]

But seems not to work. Is there any other solution?

You can use templates like this:

  'translations' => [
        'text' => 'Check our <a href="{url}">imprint</a>',
        'subject' => 'Subject'
    ]

Then in your template:

<?= I18n::template('text', null, [
      'url' => page('imprint')->url()
    ]); 
?>

https://getkirby.com/docs/cookbook/i18n/using-variables-in-language-strings