How to get node url of selected language? I have a node with an array of multiple languages.

 [19] =&gt; Drupal\node\Entity\Node Object
        (
            [in_preview] =&gt; 
            [values:protected] =&gt; Array
                (
                    [vid] =&gt; Array
                        (
                            [x-default] =&gt; 19
                        )

                    [langcode] =&gt; Array
                        (
                            [x-default] =&gt; en
                            [ca] =&gt; ca
                        )


I'm getting its url as:

$options = array('absolute' =&gt; TRUE);
$link = \Drupal\Core\Url::fromRoute('entity.node.canonical', ['node' =&gt; $key], $options);


print($link) is giving me http://test-d8.local/en/node/19 where as I want url of "ca" language not "en" language. i.e. http://test-d8.local/ca/node/19

Is there any way that gives node translations of particular langcode?

This line $language = $entity-&gt;get('langcode')-&gt;value; is giving me the value of chosen language from select list.
You want to use toUrl() with the language option.

$node-&gt;toUrl('canonical', ['language' =&gt; $node-&gt;language()]);


Unfortunately, toUrl() currently doesn't automatically respect the active language.