How to get Links to translated content in Drupal 8

Viewed 3319

I need to get the path to the translated content in Drupal8 and think getLanguageSwitchLinks() just doing this but I did not managed to make it work.

Here is my code:

$pfad = languageManager->getLanguageSwitchLinks('de', 'http://example.com/fr/produits');

print 'Pfad: ' . $pfad;

This should get me the path to the German version of http://example.com/fr/produits

Thanks for any help on this.

1 Answers
Related