Language detection

judgedrid - November 2, 2009 - 16:59
Project:Nice Menus
Version:6.x-1.3
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

For some reason nice menus fail to filter menu items based on the current language and display all the items in the menu whatever language setting they have.

#1

judgedrid - November 3, 2009 - 13:32

Answering to my own question, i modified the code a bit to support the i18nmenu module

<?php
function theme_nice_menu_build($menu) {

   
$output = '';


    foreach (
$menu as $menu_item) {
        if (
module_exists(i18nmenu))
        {
            global
$language;
           
$lang_match=($menu_item['link']['options']['langcode']==$language->language || $menu_item['link']['options']['langcode']=='');
        }
       
$mlid = $menu_item['link']['mlid'];
       
// Check to see if it is a visible menu item.
       
if (($menu_item['link']['hidden'] == 0) AND $lang_match) {
?>

 
 

Drupal is a registered trademark of Dries Buytaert.