Hook the language switcher and change the URLs it redirects to in Drupal 7
I have discovered how to do it. 

function MYTEMPLATE_language_switch_links_alter(array &amp;$links, $type, $path) {


 $extract_parameters_URL = explode("/", $_SERVER['REQUEST_URI']);

 $code_altered_url = process_URL_extracts($extract_parameters_URL);

 foreach ($links as $langcode =&gt; $link) {

    $links[$langcode]['href'] = $code_altered_url ;

 } // foreach