There is a snippet that can be used for language switching instead of the standard language switching block (see an example of page template code appended) - the point is (1) being more compact (e.g. inserting the switcher into the page header at the same level as the site name, slogan, or search box), and (2) hiding the current language (see http://drupal.org/node/226959).
It works for Drupal 5 + i18n - however, it does not work for Drupal 6 + i18n because of i18n functions being different. Does anybody know how to change this snippet to make it work for D6+i18n?
Thank you!

<div id="langswitch" style="float: right">
        -&gt; |<?php foreach (excl_translation_get_links($_GET['q']) as $link): ?>
<?php print $link?> |
<?php endforeach; ?>
<?php
// modified function
function excl_translation_get_links($path = '', $query = NULL, $names = NULL) {
  $current = i18n_get_lang();
  $names = $names ? $names : i18n_languages('native');
  foreach (array_keys(i18n_supported_languages()) as $lang){
  if ($lang != $current) {
    $url = translation_url($path, $lang);
    $links[]= theme('i18n_link', $names[$lang], i18n_path($url, $lang) , $lang, $query);
  }}
  return $links;
}
?>
    <div><!-- /end langswitch -->

Comments

ceege111’s picture

I put it in my page.tpl.php and got a WSOD.

Thanks.

C.J.

Anonymous’s picture