function translation_link

6.x translation.module translation_link($type, $node = NULL, $teaser = FALSE)

Implementation of hook_link().

Display translation links with native language names, if this node is part of a translation set.

1 string reference to 'translation_link'
locale_block in drupal-6.x/modules/locale/locale.module
Implementation of hook_block(). Displays a language switcher. Translation links may be provided by other modules.

File

drupal-6.x/modules/translation/translation.module, line 158
Manages content translations.

Code

function translation_link($type, $node = NULL, $teaser = FALSE) {
  $links = array();
  if ($type == 'node' && ($node->tnid) && $translations = translation_node_get_translations($node->tnid)) {
    // Do not show link to the same node.
    unset($translations[$node->language]);
    $languages = language_list();
    foreach ($languages as $langcode => $language) {
      if (isset($translations[$langcode]) && $translations[$langcode]->status) {
        $links["node_translation_$langcode"] = array(
          'title' => $language->native,
          'href' => 'node/' . $translations[$langcode]->nid,
          'language' => $language,
          'attributes' => array('title' => $translations[$langcode]->title, 'class' => 'translation-link')
        );
      }
    }
  }
  return $links;
}