Hi and thanks for this great module.

Can anyone clarify my options with regarding to making OM_maximenu a fully multilingual menu?
In my existing setup I have menu blocks in the maximenu that translate nicely when language is switched. Unfortunately the menulinks (that define the always-visible tab-like links along the top of the menu) don't appear to have any options for translation.

I have i18n installed but don't see anything there (strings?) that can be translated either.

I guess I could manually (and laboriously) create new Maximenus for each language and use PHP for block visibility to only show the correct one, but would prefer a cleaner and more scaleable/easier to maintain solution.

Comments

jonodunnett’s picture

To do this I used PHP in the titles to get these to translate, e.g:

global $language;
$lang_name = $language->language;
if ( $lang_name == "es" ) {
return 'Inicio';
} 
elseif ( $lang_name == "de" ) {
return 'Startseite';
} 
else {
return 'Home';
}

I have a problem now with getting the backLava / active trail effect to be active when I visit the pages which are translations... This works for the default language but not the translated languages. Any ideas how I might be able to get this to work?

jorisx’s picture

translation of the drop down content works but the main links... should i create different blocks with Om Maximenu for every language?

Kohnock’s picture

I solved it by adding the t() function to the menu item title:

file: om_maximenu.utils.inc
line 56

-$link_title = stripslashes($content['link_title']);
+$link_title = stripslashes(t($content['link_title']));

You have to define the menu item text in english and have a translation of that text to the other languages.

jorisx’s picture

Thanks that works good!

The only thing is the urls; they need to have the same name and can't be translated
so for my products page it is still called /nl/producten and /en/producten instead of /en/products

any ideas?

facal’s picture

Status: Active » Needs review

Thank you Kohnock . It is simple and works great, should be committed in next release in my opinion.

danielhonrade’s picture

Status: Needs review » Closed (fixed)

committed on dev

rv0’s picture

Version: 7.x-1.41 » 7.x-1.x-dev
Status: Closed (fixed) » Active

adding t() to the menu item title is a failed approach
t() should never be used on user submitted texts.
http://groups.drupal.org/node/149984

I guess i18n_string is the way to go?

Diane Bryan’s picture

I don't think this handles menus with image-replacement. An example of this would be a single-item where the Om Maximenu contains the entire menu as a dropdown, and the word "MENU" is replaced with an image. The URL to that image will be prepended with (t), pointing to a URL that doesn't exist.