We found this bug in mode I18N_MODE_MULTIPLE...

It seems, the menu link items don't get localized. While searching for the reason i found:

function i18n_menu_localize_tree($tree, $langcode = NULL) {
...
        // If the title is the same it will be localized by the menu system.
        if ($link['link_title'] != $router['title']) {
          $item['link']['title'] = _i18n_menu_link_title($link, $langcode);
        }
...
}

I think the upper line checking for "!=" should be:

        if ($link['link_title'] == $router['title']) {

Is this really checking wrongly by accident?

Comments

jmones’s picture

subscribe

jose reyero’s picture

Status: Active » Postponed (maintainer needs more info)

As the comment reads, in the == case, it will be localized by the (core) menu system using t(). This is about menu items generated by modules.

See http://api.drupal.org/api/drupal/includes--menu.inc/function/_menu_item_...

So do you get custom menu items not localized?

jose reyero’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Feel free to reopen with more information.

ClaudeS-1’s picture

Title: menu block link translation broken » menu link translation/localization broken
Priority: Normal » Major
Status: Closed (cannot reproduce) » Needs work

The problem isn't with the test, it's with the assignment of the translated link title back to the $item

The original link_title is stored in $item['link']['link_title'], but the code puts the translation in $item['link']['title']
I presume this has gone unnoticed by so many people because menus maybe incorrectly use $item['link']['title'] to display the title?

See this thread for more info:
http://drupal.org/node/1165472#comment-4506344

vidorado’s picture

I don't know if my problem is related to this issue, but i'm also getting untranslated link titles in the breadcrumb. I can assure that the breadcrumb is not being altered by other modules because i disabled them all. The menu items are showing properly translated when i show the menu with Superfish or with Menu Block.

I fixed the problem with this alter function in a custom module:

function <my_custom_module>_menu_breadcrumb_alter(&$active_trail, $current_item){
  
  foreach($active_trail as &$item){
    if(isset($item['mlid']))$item['title'] = _i18n_menu_link_title($item);
  }
  
}

¿Maybe i18n module would have to alter the breadcrumb too, like my module does?

jose reyero’s picture

Status: Needs work » Closed (duplicate)

These and other related issues may be fixed by this patch, #1693074: Change menu translation approach (i18n_menu_translated_menu_link_alter() skips item subtree processing)

Please give it a try.