Hi,

I have the i18n module installed, I can set nodes and menu-items to a specific language.
When I use Node Hierarchy, the automatic menu items that are created always default to English.
When I edit & save the menu-item to its correct language, and I edit the node again, the menu-item changes back to English.

Thanks,
Thomas

Comments

td540’s picture

No replies? Was I not supposed to file this under bug reports?

ronan’s picture

No, a bug report is right. I'm just not as up on my issue queue as I'd like to be.

I don't use i18n at all so I'm not familiar with this issue, but when I get a chance I'll set up a demo environment and try and reproduce it.

Thanks
Ronan

td540’s picture

Hi Ronan,

I'm gonna need this to work in a future project.
Could you maybe hint me in the right direction? Maybe I can fix it.
I have no idea where to start looking ...

thankx
td.

davidmolliere’s picture

Subscribing

svendecabooter’s picture

StatusFileSize
new833 bytes

In attachment is a patch that resolves this issue.
This patch probably only applies to the latest official release (nodehierarchy-6.x-1.2 - CVS tag DRUPAL-6--1-2) .
I noticed later versions of the DRUPAL-6--1 branch have been rewritten, so the patch doesn't apply there anymore. I should investigate the new functionalities to find out how to apply it there.
Anyway, attaching it here for anyone who is still using the latest official release and having this problem as well.

geek-merlin’s picture

ronan, tdskate,

i ran in this too and looked into the code (using 1.3).
look at nodehierarchy.module:967 _nodehierarchy_create_menu (appended at the bottom for easier collaboration)

what happens is:
- build own $node->menu as $item
- do menu_link_save($item)
- unset($node->menu) to prevent menu module from saving

naive question:
why dont we just
- build own $node->menu as $item
- set $node_menu = $item
- NOT unset($node->menu)
and let menu.module and others do their job?
this might save a lot of future patches, but of course i dont know what was the idea in the first place.

function _nodehierarchy_create_menu(&$node) {
  // If the menu is to be (re)created set the values to that derived by the hierarchy.
  if (function_exists('menu_link_save') &&
      variable_get('nodehierarchy_menus', TRUE) &&
      (user_access('administer menu') || variable_get('nodehierarchy_menu_noadmin', FALSE)) &&
      @$node->nodehierarchy_create_menu) {

    $item = $node->menu;
    if ($parent_menu = _nodehierarchy_get_menu($node->parent)) {
      $item['plid'] = $parent_menu['mlid'];
    }
    else {
      $item['parent'] = variable_get('nodehierarchy_menus_default', 'primary-links:0');
      list($item['menu_name'], $item['plid']) = explode(":", $item['parent']);
    }

    $item['link_title'] = trim($node->title);
    $item['link_path'] = "node/$node->nid";
    // Editable menu weight range used to start at -10.
    $item['weight'] = $node->order_by - 11;
    if (!menu_link_save($item)) {
      drupal_set_message(t('There was an error saving the menu link.'), 'error');
    }

    // Prevent the menu.module saving the menu itself in case
    // the module is called after this one.
    unset($node->menu);

    // Prevent the this module from attempting to create a menu twice.
    $node->nodehierarchy_create_menu = FALSE;
  }
}
asb’s picture

Any updates on this?

asb’s picture

Any updates on this?

heyyo’s picture

Component: Code » Drupal/PHP Code

Same bug with drupal 7 version, instead the menu item language is set to "undefined" so the menu item is displayed in each language.

heyyo’s picture

Version: 6.x-1.2 » 7.x-2.x-dev
heyyo’s picture

Not sure if this issue is for internationalization or node hierarchy.
I have opened an issue in i18n issue queue #1410020: Node hierarchy and language menu items with i18n

Any idea on this ? it's too bad that we can't use node hierarchy with i18n

Greg Sims’s picture

I'd like to pass along some encouragement for this! Greg

maqueelm’s picture

Status: Active » Patch (to be ported)
StatusFileSize
new1.21 KB

Parent page option is displaying more than one language
The drop down in the edit of a node for basic page type shows a page navigation drop down with options in all the language the website supports. In my case the drop down was showing the list in chineese and english and i want this drop down to be filtered on the currently active language for the website. I have updated the _nodehierarchy_parent_options function in nodehierarchy.module. For making the drop down language specific please apply the attached patch to nodehierarchy moduel. Please see the attached patch.

sherpadawan’s picture

Issue tags: +undefined
StatusFileSize
new1.18 KB

I applied the previous patch and applied a fix I did (all is in the patch attached)
But there are still issues related to menu link creation/update (impossible)

faustof’s picture

Please, any update on this?

I used patch #14, with D7.21 and doesn't work that well (node has to be edited/saved twice before the menu item is properly updated with node language settings).

Also, is it possible to specify if Node Hierarchy is compatible with i18n and/or Entity translation modules?

RAFA3L’s picture

any update? same problem