Index: i18nmenu/i18nmenu.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/i18n/i18nmenu/i18nmenu.module,v retrieving revision 1.2.2.22 diff -u -p -r1.2.2.22 i18nmenu.module --- i18nmenu/i18nmenu.module 11 Jul 2010 09:03:25 -0000 1.2.2.22 +++ i18nmenu/i18nmenu.module 11 Jul 2010 12:39:33 -0000 @@ -203,18 +203,18 @@ function i18nmenu_preprocess_page(&$vars /** * Optionally insert/update and return a localized menu item title. */ -function _i18nmenu_get_item_title($link, $update = FALSE) { +function _i18nmenu_get_item_title($link, $update = FALSE, $langcode = NULL) { $key = 'menu:item:'. $link['mlid'] .':title'; if ($update) { i18nstrings_update($key, $link['link_title']); } - return i18nstrings($key, $link['link_title']); + return i18nstrings($key, $link['link_title'], $langcode); } /** * Optionally insert/update and return a localized menu item description. */ -function _i18nmenu_get_item_description($link, $update = FALSE) { +function _i18nmenu_get_item_description($link, $update = FALSE, $langcode = NULL) { if (empty($link['options']['attributes']['title'])) { return; } @@ -223,7 +223,7 @@ function _i18nmenu_get_item_description( if ($update) { i18nstrings_update($key, $description); } - return i18nstrings($key, $description); + return i18nstrings($key, $description, $langcode); } /** @@ -257,7 +257,7 @@ function i18nmenu_form_menu_edit_menu_al } /** - * Submit handler for the menu_edit_item form. + * Submit handler for the menu_edit_menu form. * * On menu item insert or update, save a translation record. */ @@ -333,7 +333,7 @@ function i18nmenu_menu_item_update($form function _i18nmenu_update_item($item) { list($item['menu_name'], $item['plid']) = explode(':', $item['parent']); // If this was an insert, determine the ID that was set. - if (!isset($link['mlid'])) { + if (!isset($item['mlid'])) { $item['mlid'] = db_result(db_query("SELECT MAX(mlid) FROM {menu_links} WHERE link_path = '%s' AND menu_name = '%s' AND module = 'menu' AND plid = %d AND link_title = '%s'", $item['link_path'], $item['menu_name'], $item['plid'], $item['link_title'])); } if (!empty($item['mlid'])) { @@ -389,7 +389,7 @@ function i18nmenu_form_alter(&$form, &$f } // Prepare the tnode so the menu item will be available. - node_object_prepare($tnode); + _i18nmenu_node_prepare($tnode); if ($tnode->menu) { // Set default values based on translation source's menu. @@ -445,3 +445,10 @@ function i18nmenu_nodeapi(&$node, $op) { break; } } + +/** + * Helper function: load the menu item associated to the current node. + */ +function _i18nmenu_node_prepare($node) { + module_invoke('menu', 'nodeapi', $node, 'prepare'); +}