function _menu_item_localize


Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/
cis7 _menu_item_localize(&$item, $map, $link_translate = FALSE)
cle7 _menu_item_localize(&$item, $map, $link_translate = FALSE)
elmsmedia7 _menu_item_localize(&$item, $map, $link_translate = FALSE)
icor7 _menu_item_localize(&$item, $map, $link_translate = FALSE)
meedjum_blog7 _menu_item_localize(&$item, $map, $link_translate = FALSE)
mooc7 _menu_item_localize(&$item, $map, $link_translate = FALSE)

Localizes the router item title using t() or another callback.

Translate the title and description to allow storage of English title strings in the database, yet display of them in the language required by the current user.


$item: A menu router item or a menu link item.

$map: The path as an array with objects already replaced. E.g., for path node/123 $map would be array('node', $node) where $node is the node object for node 123.

$link_translate: TRUE if we are translating a menu link item; FALSE if we are translating a menu router item.

Return value

No return value. $item['title'] is localized according to $item['title_callback']. If an item's callback is check_plain(), $item['options']['html'] becomes TRUE. $item['description'] is translated using t(). When doing link translation and the $item['options']['attributes']['title'] (link title attribute) matches the description, it is translated as well.

Related topics

4 calls to _menu_item_localize()
admin_menu_translated_menu_link_alter in sites/all/modules/ulmus/admin_menu/admin_menu.module
Implements hook_translated_menu_link_alter().
_menu_link_translate in includes/
Provides menu link access control, translation, and argument handling.
_menu_translate in includes/
Handles dynamic path translation and menu access control.
_token_menu_link_translate in sites/all/modules/ulmus/token/token.module


includes/, line 668
API for the Drupal menu system.


function _menu_item_localize(&$item, $map, $link_translate = FALSE) {
  $callback = $item['title_callback'];
  $item['localized_options'] = $item['options'];
  // All 'class' attributes are assumed to be an array during rendering, but
  // links stored in the database may use an old string value.
  // @todo In order to remove this code we need to implement a database update
  //   including unserializing all existing link options and running this code
  //   on them, as well as adding validation to menu_link_save().
  if (isset($item['options']['attributes']['class']) && is_string($item['options']['attributes']['class'])) {
    $item['localized_options']['attributes']['class'] = explode(' ', $item['options']['attributes']['class']);
  // If we are translating the title of a menu link, and its title is the same
  // as the corresponding router item, then we can use the title information
  // from the router. If it's customized, then we need to use the link title
  // itself; can't localize.
  // If we are translating a router item (tabs, page, breadcrumb), then we
  // can always use the information from the router item.
  if (!$link_translate || ($item['title'] == $item['link_title'])) {
    // t() is a special case. Since it is used very close to all the time,
    // we handle it directly instead of using indirect, slower methods.
    if ($callback == 't') {
      if (empty($item['title_arguments'])) {
        $item['title'] = t($item['title']);
      else {
        $item['title'] = t($item['title'], menu_unserialize($item['title_arguments'], $map));
    elseif ($callback && function_exists($callback)) {
      if (empty($item['title_arguments'])) {
        $item['title'] = $callback($item['title']);
      else {
        $item['title'] = call_user_func_array($callback, menu_unserialize($item['title_arguments'], $map));
      // Avoid calling check_plain again on l() function.
      if ($callback == 'check_plain') {
        $item['localized_options']['html'] = TRUE;
  elseif ($link_translate) {
    $item['title'] = $item['link_title'];

  // Translate description, see the motivation above.
  if (!empty($item['description'])) {
    $original_description = $item['description'];
    $item['description'] = t($item['description']);
    if ($link_translate && isset($item['options']['attributes']['title']) && $item['options']['attributes']['title'] == $original_description) {
      $item['localized_options']['attributes']['title'] = $item['description'];



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.