Hot answers tagged

1

For a link enclosed in translatable text, Drupal core suggests to use t() and embed the HTML anchor tag directly in the translated string. In LinkGeneratorInterface::generate(), the example code for this case is the following. $text = t('Visit the <a href=":url">content types</a> page', array( ':url' => Url::fromRoute('entity.node_type....


1

It will easy if you convert link to url and use translate like this. $url = Url::fromUri('http://example.com')->toString(); t('Visit <a href=":href">link</a>', array(':href' => $url)); Example drupal core use translation with link. $requirements['online'] = array( 'title' => t('Internet'), 'value' => t('The translation ...


Only top voted, non community-wiki answers of a minimum length are eligible