function i18n_taxonomy_translation_tids in Internationalization 7
Returns an url for the translated taxonomy-page, if exists.
1 call to i18n_taxonomy_translation_tids()
- i18n_taxonomy_translate_path in i18n_taxonomy/
i18n_taxonomy.module - Find translations for taxonomy paths.
File
- i18n_taxonomy/
i18n_taxonomy.module, line 553 - i18n taxonomy module
Code
function i18n_taxonomy_translation_tids($str_tids, $lang) {
if (preg_match('/^([0-9]+[+ ])+[0-9]+$/', $str_tids)) {
$separator = '+';
// The '+' character in a query string may be parsed as ' '.
$tids = preg_split('/[+ ]/', $str_tids);
}
elseif (preg_match('/^([0-9]+,)*[0-9]+$/', $str_tids)) {
$separator = ',';
$tids = explode(',', $str_tids);
}
else {
return;
}
$translated_tids = array();
foreach ($tids as $tid) {
if ($translated_tid = i18n_taxonomy_translation_term_tid($tid, $lang)) {
$translated_tids[] = $translated_tid;
}
}
return implode($separator, $translated_tids);
}