You are here

function translation_node_select in Internationalization 5.2

Same name and namespace in other branches
  1. 5.3 translation/translation.module \translation_node_select()
  2. 5 translation/translation.module \translation_node_select()

Form to select a translation from existing nodes

1 call to translation_node_select()
translation_node_page in translation/translation.module
This is the callback for the tab 'translation' for nodes

File

translation/translation.module, line 785

Code

function translation_node_select($node, $lang) {
  $languages = i18n_supported_languages();

  // Disable i18n rewrite. Order by trid to show first nodes with no translation
  i18n_selection_mode('off');
  $result = pager_query(db_rewrite_sql("SELECT n.nid, n.title FROM {node} n INNER JOIN {i18n_node} i ON n.nid = i.nid WHERE i.language = '%s' ORDER BY i.trid"), 40, 0, NULL, $lang);
  i18n_selection_mode('reset');
  while ($trnode = db_fetch_object($result)) {
    $list[$trnode->nid] = l($trnode->title, "node/{$trnode->nid}");
  }
  if ($list) {
    return drupal_get_form('translation_node_form', $node, $lang, $list);
  }
  else {
    return t("<p>No nodes available in %language</p>", array(
      '%language' => $languages[$lang],
    ));
  }
}