The problem is that if I'm using Menu Translation (Node) module to translate nodes and the menu as well. My multilingual setup is "Mixed current language (if available) or default language (if not) and language neutral.". I'm using 3 languages. English is default. It works fine. When I'm translating nodes in other languages - everything seams to work fine, but when I'm starting to browse the site using the translated menu - the menu elements sometimes dissapears. Sometimes dissapears all the menu.
I beleive that the problem is with the Path translations. I think the menu titles are translated normaly - it is supported in the nice menus moduel. But I think the problem exists with the menu path translations, which are created by the i18nmenu_node module.

With the same setup - if I'm trying to use for example "[i18n] Primary menu" block created by i18n module - everything is fine!

Comments

mttjn’s picture

did you find a solution for this?

Drave Robber’s picture

We've been able to solve the issue of missing menu items by wrapping menu_tree_all_data() on nice_menus.module:338 in i18n_selection_mode('off') / i18n_selection_mode('reset'):

function theme_nice_menus_tree($menu_name, $mlid = NULL, $depth = -1,
$menu = NULL) {
  // Load the full menu array.
  i18n_selection_mode('off');
  $menu = isset($menu) ? $menu : menu_tree_all_data($menu_name);
  i18n_selection_mode('reset');

This is however a cargo cult style solution as it simply emulates what other modules were seen doing in similar contexts, without thorough understanding of why and how it works. :)

Also, this might be good enough for common use case, but if one wants to call the theme function directly from template or whatever, it probably should be written as:

function theme_nice_menus_tree($menu_name, $mlid = NULL, $depth = -1,
$menu = NULL) {
  // Load the full menu array if not already supplied.
  if (!isset($menu)) {
    i18n_selection_mode('off');
    $menu = menu_tree_all_data($menu_name);
    i18n_selection_mode('reset');
  }

...so that mode switching isn't done in vain in the case $menu is already supplied to the function.

I'll roll a patch tonight or tomorrow.

nor4a’s picture

Tested on my projects! Works, Thanks a Lot!

nor4a’s picture

For capability with not multilingual sites the code should look like:

function theme_nice_menus_tree($menu_name, $mlid = NULL, $depth = -1,
$menu = NULL) {
  // Load the full menu array if not already supplied.
  if (!isset($menu)) {
    if(module_exists('i18n')) i18n_selection_mode('off');
    $menu = menu_tree_all_data($menu_name);
    if(module_exists('i18n')) i18n_selection_mode('reset');
  }
Drave Robber’s picture

Of course. :)
I'd rather make it depend on i18nmenu though. At the moment, we don't really know whether the issue is related to i18nmenu_node or wider; #1350380: Translated menu items with children not showing... anyone know why? suggests the latter, but anyway it is related to multilingual menus, not i18n itself. (There are sites, few may they be, that use i18n but not i18menu.)

  // If menu array is not supplied, load it by name.
  if (!isset($menu)) {
    // In case of multilingual menus, load everything. We'll localize the tree later.
    if (module_exists('i18nmenu')) {
      i18n_selection_mode('off');
    }
    $menu = menu_tree_all_data($menu_name);
    if (module_exists('i18nmenu')) {
      i18n_selection_mode('reset');
    }
  }

Please ignore this attachment and see below.

Drave Robber’s picture

Please ignore this attachment, too :)

Drave Robber’s picture

This is the right patch (at least I hope so).

I need to be more careful. Or more coffee. Or both. :)

Drave Robber’s picture

Status: Active » Needs review
tfranz’s picture

#7 works for me – thank you very much!

udvranto’s picture

The patch did not work for me. :( Cleared the cache after the update.

astonvictor’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

I'm closing it because the issue was created a long time ago without any further steps.

if you still need it then raise a new one.
thanks