You are here

function _custompage_translate_path in Custom Page 6

Same name and namespace in other branches
  1. 7 custompage_util.inc \_custompage_translate_path()

The idea for this function comes from the original work by Jonathan Hedstrom:

See also

http://www.opensourcery.com/blog/jonathan-hedstrom/drupal-6-and-primarys...

1 call to _custompage_translate_path()
custompage_menu_tile in ./custompage_util.inc

File

./custompage_util.inc, line 186

Code

function _custompage_translate_path($link) {
  global $language;
  if ($language && module_exists('translation')) {

    // get a list of all available paths
    $new_paths = translation_path_get_translations($link['href']);
    if ($new_paths[$language->language]) {

      // if a translated path exists, set it here
      $link['href'] = $new_paths[$language->language];
    }

    // translate the title (this adds every menu title to the locale_source
    // table, for later translation
    $link['title'] = t($link['title']);
    if ($link['attributes']['title']) {
      $link['attributes']['title'] = t($link['attributes']['title']);
    }
  }
  return $link;
}