You are here

function i18ntaxonomy_translation_term_tid in Internationalization 6

Get translated term's tid.

Parameters

$tid: Node nid to search for translation.

$language: Language to search for the translation, defaults to current language.

$default: Value that will be returned if no translation is found.

Return value

Translated term tid if exists, or $default.

1 call to i18ntaxonomy_translation_term_tid()
i18ntaxonomy_translation_tids in i18ntaxonomy/i18ntaxonomy.module
Returns an url for the translated taxonomy-page, if exists.

File

i18ntaxonomy/i18ntaxonomy.module, line 230
i18n taxonomy module

Code

function i18ntaxonomy_translation_term_tid($tid, $language = NULL, $default = NULL) {
  $translation = db_result(db_query("SELECT t.tid FROM {term_data} t INNER JOIN {term_data} a ON t.trid = a.trid AND t.tid <> a.tid WHERE a.tid = %d AND t.language = '%s' AND t.trid > 0", $tid, $language ? $language : i18n_get_lang()));
  return $translation ? $translation : $default;
}