I'm not sure if this issue is related to this module or to the i18nmenu module but for pathauto I always use the [menupath-raw] token. But when I enabled this module the translated pages receive the menupath of the source language. So what I've done is created a separate module that adds an [i18n-menupath-raw] token. Perhaps this new module can be integrated into this module.

Comments

vurt’s picture

First I have to thank for the wonderful i18nmenu - great idea. For many websites this approach fits much better.

We had the same problem with paths as Johnny. Using his module fixed this - also a big thank you!

I think it would be a good idea to integrate the module - or it there another place where this token could be useful?

Cheers

plach’s picture

This is a desirable feature. I'll try to look into this asap.

plach’s picture

Project: Menu translation (Node) » Internationalization
Component: Code » Menus
plach’s picture

Project: Internationalization » Menu translation (Node)
Component: Menus » Code

Sorry, I did not consider that i18nmenu does not touch node menu item paths. Moving back to the MTN queue.

plach’s picture

Status: Active » Needs review
StatusFileSize
new3.02 KB

Here is a patch based on the code posted in the OP.

Please note that due to the above issue with Pathauto, the token has been renamed to [i18n-menuhierarchy-raw]. Until that one is fixed we need to configure puntuaction settings to leave alone slashes to have working aliases.

Note also that the i18n- namespace should be used by the i18n project, but in this case Menu Translation (which is the right place where implement any other [i18n-menu*] token) does not need the hierarchy token, as it relies on menu item replication (which works with the standard [menupath-raw] token), so this should not be an issue.

Johnny vd Laar’s picture

Great i'll try to test this somewhere in the next few weeks. I'm overly busy with deadlines.

plach’s picture

StatusFileSize
new1.67 KB

Rerolled

plach’s picture

Status: Needs review » Fixed

Committed to HEAD.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Johnny vd Laar’s picture

you've renamed the token to i18n-menuhierarchy-raw but this is in the pathauto module

function pathauto_clean_token_values($full) {
  foreach ($full->values as $key => $value) {
    // If it's a "path" or "url friendly" token don't remove the "/" character
    if (drupal_substr($full->tokens[$key], -4, 4) === 'path' || drupal_substr($full->tokens[$key], -8, 8) === 'path-raw' || drupal_substr($full->tokens[$key], -5, 5) === 'alias') {
      $full->values[$key] = pathauto_cleanstring($value, FALSE);
    }
    else {
      $full->values[$key] = pathauto_cleanstring($value);
    }
  }
  return $full->values;
}

so if the token doesn't contain path, path-raw or alias then all slashes are removed.

so i propose to rename the token to i18n-menuhierarchy-path-raw

plach’s picture