function translation_node_nid in Internationalization 5
Same name and namespace in other branches
- 5.3 translation/translation.module \translation_node_nid()
- 5.2 translation/translation.module \translation_node_nid()
Get translated node's nid
Parameters
$nid: 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 node nid if exists, or $default
1 call to translation_node_nid()
- translation_url in translation/
translation.module - Produces url of translated page
File
- translation/
translation.module, line 1106
Code
function translation_node_nid($nid, $language = NULL, $default = NULL) {
$translation = db_result(db_query("SELECT n.nid FROM {i18n_node} n INNER JOIN {i18n_node} a ON n.trid = a.trid AND n.nid != a.nid WHERE a.nid = %d AND n.language = '%s' AND n.trid", $nid, $language ? $language : i18n_get_lang()));
return $translation ? $translation : $default;
}