I'm using localizer 5.x-3.3 and Pathauto.
Everything works perfectly except for the Primary and Secondary menu.
None of them have the .active class when I'm in the node. Wether it be the orignial node or the translated node.

If I manually add the language abbreviation in url_alias.src in the database, it works.

Has anyone else had this issue before?
Am I doing something wrong?

Comments

greggles’s picture

Title: Menu links not .active » Menu links not .active when using localizer

Sorry, I'm not sure what could be causing this. One bug that sounds similar is the image gallery alias menu problem: http://drupal.org/node/225002

Perhaps it's a broader problem than that description claims?

teebo’s picture

Thanks for the reply.

Here is the link to the website: link

teebo’s picture

Priority: Normal » Critical
Status: Active » Postponed (maintainer needs more info)

I found a solution.

Thanks to this note: http://drupal.org/node/41629#comment-364435

It's a dirty solution because you have to modify common.inc; but it does the job (until a real fix can be found).

Line #1275 in common.inc; replace:
if (($path == $_GET['q']) || ($path == '<front>' && drupal_is_front_page())) {
By
if (($path == $_GET['q']) || ($path == '<front>' && drupal_is_front_page()) || (drupal_get_normal_path(i18n_get_lang(). "/". $path) == $_GET['q'])) {

greggles’s picture

Category: support » feature
Priority: Critical » Normal

You marked this as critical, but I'm afraid I don't see this as a critical item since it only is visible with the localizer module. That's not critical in the scope of Pathauto.

If you marked it as critical because you feel this should be worked on faster then I suggest:

1. State clearly what Pathauto needs to do differently to the extent you can. You've described a symptom, but it's not clear specifically what Pathauto is doing wrong and what it should be doing.
2. Provide a bounty to get people interested in working on it. I'm not personally interested in working on it and unless you can fix it it seems unlikely to get attention.

teebo’s picture

Priority: Normal » Minor
Status: Postponed (maintainer needs more info) » Closed (fixed)

Sorry about that.

It's probably a Localizer issue seeing the (partly)fix I found.

VivekDubey’s picture

Project: Pathauto » Localizer
Category: feature » support
Status: Closed (fixed) » Postponed (maintainer needs more info)

Yes, I agree this is a dirty solution but it’s better than no solution. Here is the code for using with localizer module. I hope this will help.
But I would still like to request the Module maintainers of Localizer module to come up with some proper solution within the module to avoid such hacks.

Line #1275 in common.inc; replace:

if (($path == $_GET['q']) || ($path == '' && drupal_is_front_page())) {
By
if (($path == $_GET['q']) || ($path == '' && drupal_is_front_page()) || (drupal_get_normal_path(localizer_get_language() . "/". $path) == $_GET['q'])) {

Arhips’s picture

A slightly less dirty approach would be to override HTML rendering of menu links with a theme function... followed by a fixed version of the l() function.

Placing the following 2 functions in template.php will do the trick without having to mess with common.inc

function phptemplate_menu_item_link($item, $link_item) {
  return fixed_l($item['title'], $link_item['path'], !empty($item['description']) ? array('title' => $item['description']) : array(), isset($item['query']) ? $item['query'] : NULL);
}
function fixed_l($text, $path, $attributes = array(), $query = NULL, $fragment = NULL, $absolute = FALSE, $html = FALSE) {
  //if (($path == $_GET['q']) || ($path == '<front>' && drupal_is_front_page())) {
	if (($path == $_GET['q']) || ($path == '<front>' && drupal_is_front_page()) || (drupal_get_normal_path(i18n_get_lang(). "/". $path) == $_GET['q'])) { 
    if (isset($attributes['class'])) {
      $attributes['class'] .= ' active';
    }
    else {
      $attributes['class'] = 'active';
    }
  }
  return '<a href="'. check_url(url($path, $query, $fragment, $absolute)) .'"'. drupal_attributes($attributes) .'>'. ($html ? $text : check_plain($text)) .'</a>';
}

---
Arhips the Super CEO
www.comeks.com