You are here

function translation_taxonomy_overview in Internationalization 5.2

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

Generate a tabular listing of translations for vocabularies.

1 call to translation_taxonomy_overview()
translation_taxonomy_admin in translation/translation.module
This is the callback for taxonomy translations

File

translation/translation.module, line 957

Code

function translation_taxonomy_overview($vid) {
  $vocabulary = taxonomy_get_vocabulary($vid);
  drupal_set_title(check_plain($vocabulary->name));
  $languages = i18n_supported_languages();
  $header = array_merge($languages, array(
    t('Operations'),
  ));
  $links = array();
  $types = array();

  // Get terms/translations for this vocab
  $result = db_query('SELECT * FROM {term_data} t WHERE vid=%d', $vocabulary->vid);
  $terms = array();
  while ($term = db_fetch_object($result)) {
    if ($term->trid && $term->language) {
      $terms[$term->trid][$term->language] = $term;
    }
  }

  // Reorder data for rows and languages
  foreach ($terms as $trid => $terms) {
    $thisrow = array();
    foreach ($languages as $lang => $name) {
      if (array_key_exists($lang, $terms)) {
        $thisrow[] = l($terms[$lang]->name, 'taxonomy/term/' . $terms[$lang]->tid);
      }
      else {
        $thisrow[] = '--';
      }
    }
    $thisrow[] = l(t('edit'), "admin/content/taxonomy/{$vid}/translation/edit/{$trid}");
    $rows[] = $thisrow;
  }
  $output .= theme('table', $header, $rows);
  $output .= l(t('new translation'), "admin/content/taxonomy/{$vid}/translation/new");
  return $output;
}