2

Currently I am working on a multilingual website and have already a multilingual set-up. Now I have translated menu items and it is working great, however I also want the menu title to be translated.

This is how I get the menu titles:

$menuInfo = menu_load('menu-second-menu');

and I get the title through by $menuInfo['title'];

I print the links with the following code (and the title is displayed above):

print theme('links__system_main_menu', array('links' => $menu, 'attributes' => array('id' => $menuInfo['menu_name'], 'class' => array('links', 'clearfix')), 'heading' => array('text' => $menuInfo['title'], 'level' => 'h3')));

So the links are translated, but the $menuInfo['title'] not and $menuInfo does not contain any translated information.

Any help?

Edit: The issue is I do not know how to get the translated menu title (programmatically) I made in Structure -> Menus -> Second Menu -> click the tab Translate and gave a different Menu title for the different languages. I am using the Menu Translation (sub)module of the i18n Internationalization module.

0

Enable locale and Translation module, goto admin/config/regional/translate/translate select the language and enter the corresponding English statement, then translate it.

  • These modules are already enabled. The point is I do not know how to get the translated menu title I made in Structure -> Menus -> Second Menu, than click the tab Translate and gave a different Menu title for the different languages. – peppol Aug 23 '14 at 15:26
  • did you search the original phrase? – M a m a D Aug 23 '14 at 15:54
  • I have searched yes, I found another thread discussing how to get the menu title using the menu_load('menu-name'); function, but apparently the Internationalization module doesn't hook into this one. – peppol Aug 23 '14 at 16:44
0

The only solution I could come up with, to translate the menu title is by using the following:

$menu = menu_load('main-menu');
$menu_title = i18n_string_translate('menu:menu:main-menu:title', $menu['title']);
$menu_desc = i18n_string_translate('menu:menu:main-menu:description', $menu['description']);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.