I needed to get i18n block work with translated nodes and their different aliases without language prefix.
for example
node/16 -> o-projekcie ( first language )
node/19 -> about-project ( node 16 translated to second language )
I made some changes to i18n_get_links:
function i18n_get_links($path = '', $query = NULL, $names = NULL) {
if($path == i18n_frontpage()) {
$path = '';
}
$names = $names ? $names : i18n_languages('native');
foreach (array_keys(i18n_supported_languages()) as $lang){
$nid = arg(1);
//if this is node and we have node id
if( arg(0)=='node' && !empty($nid) ) {
//if lang in loop is different that current website lang get translation id
if(i18n_get_lang()!=$lang) {
$node = node_load(arg(1));
$path = 'node/' . $node->translation[$lang]->nid;
//else set path to current node value if we still need current lang flag
} else {
$path = 'node/' . $nid;
}
}
$links[$lang]= theme('i18n_link', $names[$lang], i18n_path($path, $lang), $lang, $query);
}
return $links;
}
Sorry that im not using patch, im not very familiar with CVS.
Please let me know what do you think about these changes.
Comments
Comment #1
jose reyero commentedNo new features for 5.x.
Try 6.x