Hi all,

Right now i am using a certain code in template.php in order to add a class to my primary links.

function kardasis_menu_item_link($link) {
if (empty($link['localized_options'])) {
$link['localized_options'] = array();
}
if (empty($link['localized_options']['attributes']['class'])) {
$link['localized_options']['attributes']['class'] = 'menu-'. $link['mlid'];
}
else {
$link['localized_options']['attributes']['class'] .= ' menu-'. $link['mlid'];
}
return l($link['title'], $link['href'], $link['localized_options']);
}

My menu is based on images including the text. I managed using the above snippet to do this but suddenly my client asked for another two languages to be included to the website. My question therefore is the following. How can i append the language prefix of the current language where the user is located?

Right now the output of a menu item is eg. menu-744 for every language and i would like something like menu-744en for the english version and menu-744it for italian version.

Comments

timpiche’s picture

You can use global $language to output the 2 character language code.

Example:

<?php
global $language;
print $language->language;
?>
agapiou’s picture

Great thanks a lot.

timpiche’s picture

Your welcome!