How to alter a link of the language switcher? I would like to alter the link displayed on the language switcher for the second language of my site, for a certain node. Essentially when you viewing a certain node in the main language, and then use the language switcher to view the secondary language, I want the language switcher to serve a different link from the one that links to the translation of the node on the main language. (The design of this node is different from the one on the main language, so just translating the node won't help in this case)

I've tried both 
MYTHEME_preprocess_links__language_block(&amp;$variables) and
MYMODULE_language_switch_links_alter(array &amp;$links, $type, \Drupal\Core\Url $url) but in both cases either the variable I was interested was protected or private or I couldn't get any interesting variables to work with.

Is it allowed to use these hooks above for what I'm after, or it needs to be a more hacky way?
To wrap this up, here is the complete solution to this problem.

function mytheme_preprocess_links__language_block(&amp;$variables) {
  $internal_path = $variables['links']['ja']['link']['#url']-&gt;getInternalPath();

  // In this case 'node/30074' is the translated node that will normally go to 
  if ($internal_path == 'node/30074') {

    // We need to create a new Url object with the node we need to redirect to
    $new_internal_path = Drupal\Core\Url::fromRoute('entity.node.canonical', ['node' =&gt; 30073], []);

    // ...and replace the original Url object  
    $variables['links']['ja']['link']['#url'] = $new_internal_path;
  }
}


Thanks to Clive for pointing out the process for this problem.