This module does not work correctly when "Menu translation" from i18n package is enabled.
The link works correctly however.

Comments

jvieille’s picture

Category: bug » task

Rather a task than a bug: something to polish up (though very important).

castawaybcn’s picture

I would be very interested in this. Let me know if I can help testing patches, and thanks for such a great module.

erni bert’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

same here - I need menu translation AND *LOVE* the idea of menu token

jvieille’s picture

Unmaintained module?

develcuy’s picture

@jvieille, it is being maintained in maintainers free time, we are happy to see the module growing and thanks for your patience on future bug fixing and improvements. If you are interested con co-maintaining this module to make it move faster and help more than 6k websites to have a better Menu token, please apply. Drupal community is all about collaboration ;)

jvieille’s picture

Thanks for the reassuring notice, It is just about the lack of reaction of the maintainer showing he was monitoring the feedback activity - even to say the issue cannot be resolved for the time beiing and asking for additional support.

By the way, the usage statistics is amazing, your module rocks!
Thanks again

farhadhf’s picture

Hi,
I'm have the same problem and I'd like to co-maintain this module, just need a little help to get started, do you have time for a chat?

Thanks!

fraweg’s picture

Hello,

I have the same issue. A patch was really great.

Best regards
Frank

xiukun.zhou’s picture

This problem is because the default is token_menu run before the i18n translation. And so this is why menu_token does not work.
Apply the patch then run update.php

xiukun.zhou’s picture

Status: Active » Needs review
stevieegee’s picture

Hi Zhou

I used your patch and received "Fatal error: Cannot redeclare menu_token_update_7004()". I changed menu_token_update_7004() to menu_token_update_7005() (I have little php knowledge, so my attempt was a fudge). I didn't receive the error but I still didn't get the desired result.

Stephen

xiukun.zhou’s picture

thanks very much steviegee.

When I was working on this patch, menu_token_update_7004 does not exist yet. So I put down my update into menu_token_update_7004. Right now it seems that menu_token_update_7004 already exists. So the update has to change into menu_token_update_7005. This patch applies to 7.x-1.0-beta4 and 7.x-1.x-dev.

stevieegee’s picture

Hi Zhou

It looks like it is working now. I kept receiving path errors when trying to save a path after the installing the patch. I deleted the problematic menu, started afresh with a new one and it worked fine.

Thank you for the patch.

dydave’s picture

Hi guys,

Thanks a lot for the great work on this issue.
I have tested and reviewed the patch submitted by xiukun.zhou at #12, and it seems to be working as expected.

Since we usually work on many multi-lingual projects that require additional localization capabilities with Internationlization, we would greatly appreciate if a module maintainer could take a closer look at this patch and potentially consider rolling/committing it in, so that we could get this issue fixed.

Any further feedback, comments, questions, concerns or suggestions on this issue or patch, would be greatly appreciated (especially from maintainers).

Thanks in advance for your testing, reporting and feedback.
Cheers!

develcuy’s picture

Status: Needs review » Reviewed & tested by the community

@DYdave, thanks for the feedback, just make sure to change the status of the issue next time ;)

develcuy’s picture

Status: Reviewed & tested by the community » Needs work

Patch needs to be re-rolled, also please test along with Menu per role, since it should have a higher weight than Menu token, so would need to change the docs in case decide to assign a default weight.

Anonymous’s picture

Running into the same problem today.

stevieegee: Are you saying that you had to delete any menu that used tokens in the path then recreate them after applying the patch? I really don't want to have to do that.

stevieegee’s picture

I think I had to delete the menu but it was a while ago. What error are you receiving? That could jog my memory.

Anonymous’s picture

I was having two problems:

1. The tokens in the menu titles no longer work when a menu is translated. Hence something like user/[current-user:uid] no longer works at all in any language. Fortunately tokens in the menu paths continued to function. This is is generally more critical as it affects the menu items ability to function.

2. For some strange reason, menu items that were translated may or may not appear in the translated language menu when it is accessed by a user. I found that by enabling menu token for the menu item, even if it did not use tokens, caused the menu item to begin appearing in the translated language as expected. I found that I could then go back and disable menu token the menu item would continue to display properly in each assigned language.

Not sure why solution in number two works, but listed here in case it helps someone else. Problem in number 1 remains, I am hesitant to apply the untested patch.

stevieegee’s picture

I am sorry but I think my problem was slightly different. The patch did worked for me but I did start with a fresh menu. Also my menus are created via a multilingual taxonomy view so might act differently. The only thing I could suggest is install a quick dev test site using your existing site config, delete the menus and see if it works. Sorry I can't be more helpful.

kopeboy’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta5
Priority: Normal » Major
Issue summary: View changes
Status: Needs work » Needs review

So this isn't included in any stable release after 2 years yet??

I am using menu token 1.0-beta5 and translating the title with i18n. It works everywhere but on node/edit pages, where it always shows the original language.

If I instead translate the menu item with Entity Translation () I will get a duplicated menu item on node/edit pages, which is even worse of course.

Isn't the patch working?

@trainingcity your last comment behaviour was with or without the patch? I don't care if I can't use tokens in the title, but I want the translation to work the same on every page of my site! Have you tested on node/edit pages of nodes that are translatable with Entity Translation?

UPDATE: my particular issue was not related to this module. For those interested I was able to fix this using patch #9 here: https://www.drupal.org/node/2136815 (very simple patch, you can apply it manually with a text editor for any version of i18n module)

  • develCuy committed c8e4dd9 on 7.x-1.x authored by xiukun.zhou
    Issue #1590424 by xiukun.zhou, stevieegee, DYdave: Token in menu item...
develcuy’s picture

Version: 7.x-1.0-beta5 » 7.x-1.x-dev
Status: Needs review » Fixed

@kopeboy, I know it was not your intention to mess-up with the issue queue. BTW, no code changes are possible to released code, that is way patches need to be rolled against the dev branch.

We are in a dead-lock here, the are other modules that should run BEFORE Menu Token, and others after. But since i18n module is broadly used, it is better to keep compatibility with it, so decided to accept the patch! If there is people reporting compatibility issues with other modules, we'll have to work each case individually.

Status: Fixed » Closed (fixed)

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

jvieille’s picture

This patch does not work.
I fixed it this way:

  // Check whether we should replace the path.
  if (isset($menu_token_item)) {
    // If item is generated by admin menu module, tokens should not be replaced and
    // indicator that tokens are used should be shown.
    if (_menu_token_menu_admin($item)) {
      $item['title'] .= theme('menu_token_uses_tokens');
      $item['localized_options']['html'] = TRUE;
    }
    else {
      // Replace with tokens.
      $item['title'] =  token_replace($item['title'], 'global');
+    $item['link_title'] =  $item['title'];
      $item['link_path'] = token_replace($menu_token_item['link_path'], 'global');
      $item['href'] = $item['link_path'];
develcuy’s picture

@jvieille, thanks for your report. Btw this issue is pretty old, please open a new issue. Thanks!