Hi,

My site is multilingual, i have problems in the breadcrumb (it not display the menu of the current language).

CommentFileSizeAuthor
#12 1514830.patch791 bytesRyanPrice
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

latulipeblanche’s picture

I use Menu Breadcrumb on a multilingual site with two menus with their own language (one menu in English and the other in French) and the breadcrumb changes depending on language.
The administration menu changes also when changing language.

Are you sure that it's the breadcrumb generated by "Menu Breadcrumb" module you have on your site ?

I'm not sure if this can help you but you can always do a drush cc all (clear the cache) and/or refresh and update strings for languages.(admin/config/regional/translate/i18n_string)

Paul

anou’s picture

Hello,
maybe it works fine if you have 2 menus, but if like me you have set your menu on "Translate and Localize. Menu items with language will allow translations. Menu items without language will be localized.", the breadcrumb won't get translated. Only the "home" link gets translated...

I'm still on it to find a solution. If I found one, I'll be glad to share it, but if someone has allready found the solution, I'll be glad to hear from it ;-)

ganagus’s picture

Confirmed this behavior. I have the same setup where each menu item is only one for two languages, each menu item will only get localized. Only the home menu is translated in breadcrumb, not the trailing menu items.

But I don't use Menu Breadcrumb module, so I think the issue doesn't belong here.

anou’s picture

I must agree with ganagus. It's true that the translation wasn't functioning on breadcrumb before I installed Menu breadcrumb... Did you manage to find a solution for this issue ?

emorency’s picture

I had the same problem. One menu for 2 languages and translated menu items. To achieve to translate the breadcrum, I had to implement this hook:

function MYMODULE_menu_breadcrumb_alter(&$active_trail, $item) {

  foreach (array_keys($active_trail) as $key) {
    $active_trail[$key]['title'] = t($active_trail[$key]['title']);
  }
}

Hope this helps !

- Etienne

davemybes’s picture

Using the t() wrapper gets the breadcrumbs to translate, but it feels a bit hacky to me. My issue is basically the same, except I have separate menus for each language (3 of them) using ENTITY translation. So each menu actually points to the same node, which causes this module to throw out the title from the default language (English) and not the current one. In other words, its not Entity Translation aware. Not sure how to tackle that one, though.

wranvaud’s picture

I'm having this issue too but I have two menus, one for each language, like latulipeblanche.
I'm using adaptive themes and corolla (7.X-2), the menu breadcrumb only works on the default language.
I've activated menu breadcrumb, activated breatdcrumbs in the theme, cleared the cache, updated strings, ran cron (just in case)... I also tried unchecking the english main menu and leaving only translated menus as source for breadcrumbs (this doesn't change a thing actually), I tried erasing the regex in the advanced box and many other things... I'm pretty sure it's not a matter of configuration by now.
I've also checked issues related to the theme http://drupal.org/node/1497224#theme_breadcrumb%28%29
What happens in that on all languages except english, the breadcrumb displays the book outline instead of the menu. I've unchecked the option to use book menus as a source for menu breadcrumbs too without any effect.
Any idea what's going on?

mzwyssig’s picture

Same issue here, with entity translation.

Subscribing.

Anonymous’s picture

I am not using the /menu Breadcrumb but had the same issue as above. The solution by @emorency helped (thanks) but not fully since it was not using context just plain t().
Modifications:

  • Skip the Home Page since the "Home" was translated out of the box
  • Use i18n_string_translate() instead of t()

I am using one menu, translated and localized. And here is the code that worked for me...

//breadcrumb fix
    function THEME_NAME_menu_breadcrumb_alter(&$active_trail, $item) {
        global $language ;
        $lang_name = $language->language;
        $i = 0;
        foreach (array_keys($active_trail) as $key) {
            if($i!=0){
                $translatedValue = i18n_string_translate(array('menu', 'item', $active_trail[$key]['mlid'], 'title'), $active_trail[$key]['title'], array('langcode' => $lang_name, 'sanitize' => FALSE));
                $active_trail[$key]['title'] = $translatedValue;
            }
           $i++;
        }
    } 

This probably should be submitted to the i18n team for review... But for now hope this helps someone... :)

Drupal Developer in Toronto

alejandrov’s picture

nathan6137, your code works fine but I changed it in this way for prevent undefined index errors :

//breadcrumb fix
function THEME_NAME_menu_breadcrumb_alter(&$active_trail, $item) {
    global $language ;
    $lang_name = $language->language;
    foreach (array_keys($active_trail) as $key) {
    if(array_key_exists('mlid',$active_trail[$key]) ){
        $translatedValue = i18n_string_translate(array('menu', 'item', $active_trail[$key]['mlid'], 'title'), $active_trail[$key]['title'],      array('langcode' => $lang_name, 'sanitize' => FALSE));
        $active_trail[$key]['title'] = $translatedValue;
      }
     }
} 

btw, for new users, I added this function into template.php :)

truyenle’s picture

Issue summary: View changes

None of these are working for me. I have a site in English / French. When having above, I have breadcrumb is always in French although the site is in English.

RyanPrice’s picture

FileSize
791 bytes

@truyenle - Can you try this patch and let me know if it works for you?

  • RyanPrice committed 6553bc3 on 7.x-1.x
    Issue #1514830 by RyanPrice: Menu breadcrumb not takes into account the...
  • RyanPrice committed 91b5c07 on 7.x-1.x
    Issue #1514830 by RyanPrice: Menu breadcrumb not takes into account the...
RyanPrice’s picture

Status: Active » Closed (fixed)