You are here

function i18nmenu_translate_all in Internationalization 5.3

Same name and namespace in other branches
  1. 5 contrib/i18nmenu.module \i18nmenu_translate_all()
  2. 5.2 contrib/i18nmenu.module \i18nmenu_translate_all()
1 call to i18nmenu_translate_all()
i18nmenu_menu in contrib/i18nmenu.module
Implementation of hook_menu().

File

contrib/i18nmenu.module, line 23

Code

function i18nmenu_translate_all() {
  global $_menu;
  global $user;
  global $locale;
  $cid = "{$user->uid}:{$locale}";
  cache_clear_all($cid, 'cache_menu');

  // Translate all user defined meny items
  foreach ($_menu['items'] as $mid => $item) {
    if ($item['type'] & MENU_CREATED_BY_ADMIN) {
      $_menu['items'][$mid]['title'] = tt("menu:item:{$mid}:title", $_menu['items'][$mid]['title']);
      $_menu['items'][$mid]['description'] = tt("menu:item:{$mid}:description", $_menu['items'][$mid]['description']);
    }
  }

  // Update cache
  cache_set($cid, 'cache_menu', serialize($_menu), time() + 60 * 60 * 24);
}