Hi there!

I got a view language modules (i18n, etc) installed, but unfortunately the "language switcher" on my left sidebar doesn't seem to work... With a standard drupal theme its all doing good, so the installation seems correct! Just can't figure out the error at my custom template...

I got clean URL's enabled. One default language (german) with no path prefix, for the second laguage (english) - the path prefix "en" (www.mydomain.com/en/) ... But the URLs executed at the switcher remain all the same for Admin Menu and any other nodes without a translation.

Example:

If I'm on page:

www.mydomain.com/en/admin/ the URL for German remains unchanged www.mydomain.com/en/admin/ (and vise versa)

Now if I create a node and and ad a translation, e.g:

www.mydomain.com/kontakt/ the URL for the english translation is displayed as: www.mydomain.com/node/66 and NOT as www.mydomain.com/en/contacts/ as intended for this node translation ...

Has anyone dealt with a similar error before? Like I said, it works correct on standard drupal themes, but unfortunately not with mine!

Any help appreciated!

regards
hilrap

Comments

hilrap’s picture

Any help for this one? Here a list of all my multilanguage modules activated:

Block translation

Content type translation

Internationalization

Language Icons

Localization client

Menu translation

Poll aggregate

String translation

Synchronize translations

Taxonomy translation

Translation overview

hilrap’s picture

Ok, found the where about of this error.

Disabling the template.php works for the language switch like a charm. ;-)

Since I did not write template.php myself, could anyone please explain its use? At first sight I can't see any negative changes on the theme ones disabled... Here it's what it reads:

<?php
function theme123_menu_local_task($link, $active = FALSE) {
  return '<li '. ($active ? 'class="active" ' : '') .'><span><span>'. $link ."</span></span></li>\n";
}
function theme123_l($text, $path, $options = array()) {
  // Merge in defaults.
  $options += array(
      'attributes' => array(),
      'html' => TRUE,
    );

  // Append active class.
  if ($path == $_GET['q'] || ($path == '<front>' && drupal_is_front_page())) {
    if (isset($options['attributes']['class'])) {
      $options['attributes']['class'] .= ' active';
    }
    else {
      $options['attributes']['class'] = 'active';
    }
  }

  // Remove all HTML and PHP tags from a tooltip. For best performance, we act only
  // if a quick strpos() pre-check gave a suspicion (because strip_tags() is expensive).
  if (isset($options['attributes']['title']) && strpos($options['attributes']['title'], '<') !== FALSE) {
    $options['attributes']['title'] = strip_tags($options['attributes']['title']);
  }

  return '<a href="'. check_url(url($path, $options)) .'"'. drupal_attributes($options['attributes']) .'>'. ($options['html'] ? $text : check_plain($text)) .'</a>';
}

/**
* Override theme_links to include <span> in list.
*/
function theme123_links($links, $attributes = array('class' => 'links')) {
 $output = '';
  if (count($links) > 0) {
    $output = '<ul'. drupal_attributes($attributes) .'>';
    $num_links = count($links);
    $i = 1;
    foreach ($links as $key => $link) {
      $class = '';
      // Automatically add a class to each link and also to each LI
      if (isset($link['attributes']) && isset($link['attributes']['class'])) {
        $link['attributes']['class'] .= ' ' . $key;
        $class = $key;
      }
      else {
        $link['attributes']['class'] = $key;
        $class = $key;
      }
      // Add first and last classes to the list of links to help out themers.
      $extra_class = '';
      if ($i == 1) {
        $extra_class .= 'first ';
      }
      if ($i == $num_links) {
        $extra_class .= 'last ';
      }
      // Add class active to active li
      $current = '';
      if (strstr($class, 'active')) {
        $current = ' active';
      }
      $output .= '<li class="'. $extra_class . $class . $current .'">';
      // Is the title HTML?
      $html = isset($link['html']) && $link['html'];
      // Initialize fragment and query variables.
      $link['query'] = isset($link['query']) ? $link['query'] : NULL;
      $link['fragment'] = isset($link['fragment']) ? $link['fragment'] : NULL;
      if (isset($link['href'])) {
        $spanned_title = "<span ". drupal_attributes($link['attributes']) ."><span>".$link['title']."</span></span>";
// In the line above, you could take out the drupal_attributes var and specify your class
		
       $output .= theme123_l($spanned_title, $link['href'], $link['attributes'], $link['query'], $link['fragment']);
      } else if ($link['title']) {
        //Some links are actually not links, but we wrap these in <span> for adding title and class attributes
        if (!$html) {
          $link['title'] = check_plain($link['title']);
        }
        $output .= '<span'. drupal_attributes($link['attributes']) .'>'. $link['title'] .'</span>';
      }
      $i++;
      $output .= "</li>\n";
    }
    $output .= '</ul>';
  }
  return $output;
}
?>

Which part of this is responsible for the error described above?