You are here

function translation_term_get_translations in Internationalization 5.3

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

Get term translations

Return value

An array of the from lang => Term

2 calls to translation_term_get_translations()
translation_node_prepare in translation/translation.module
Prepare node for translation
translation_taxonomy_term_form in translation/translation.module
Produces a vocabulary translation form

File

translation/translation.module, line 1086

Code

function translation_term_get_translations($params, $getall = TRUE) {
  foreach ($params as $field => $value) {
    $conds[] = "i.{$field} = '%s'";
    $values[] = $value;
  }
  if (!$getall) {

    // If not all, a parameter must be tid
    $conds[] = "t.tid <> %d";
    $values[] = $params['tid'];
  }
  $conds[] = "t.trid <> 0";
  $sql = 'SELECT t.* FROM {term_data} t INNER JOIN {term_data} i ON t.trid = i.trid WHERE ' . implode(' AND ', $conds);
  $result = db_query($sql, $values);
  $items = array();
  while ($data = db_fetch_object($result)) {
    $items[$data->language] = $data;
  }
  return $items;
}