Community & Support

Removing language links in node links

I'm pretty sure this is easy as I've done multi-lingual before and never had this problem, anyway... here goes :)

I've got a multi-lingual site in two languages with translations. At the bottom of every multi-lingual node I have a link to the translation of that page. For example, next to "Add a new comment" I have "Francais" that links to the French version of the page.

How can I get rid of these links? I have a language switcher block so there is really no need for them.

Thanks,

Adam

Comments

Still not there...

Ok so I managed to do it through CSS...

.translation-link {
display: none;
}

but this is far from ideal as it just leaves a big gap at the bottom of nodes where it would be.

Any help would be greatly appreciated!

Remove node links using phptemplate_preprocess_node()

I was able to remove these links using the phptemplate_preprocess_node() function. Here's the code to add to your theme's template.php file:

<?php
function phptemplate_preprocess_node(&$vars) {
 
$node = $vars['node'];
 
// Remove translation links
 
foreach ($node->links as $key => $value) {
    if (
$value['attributes']['class'] == 'translation-link') {
      unset(
$node->links[$key]);
    }
  }
 
$vars['links'] = theme('links', $node->links, array('class' => 'links inline'));
}
?>

There should probably be a better way to do this; it would be great to be able to configure this within the i18n module itself, but this technique works for now.

not working

Your preprocess function should work, i think but it ist on my site.

I changed the function name, what am i doing wrong?
i have version 6.9 of drupal

What did you rename the

What did you rename the function to? If you're using a phptemplate theme, try inserting the code exactly as I've provided it. If you already have the line function phptemplate_preprocess_node(&$vars) { in your template.php file, simply insert the following code on a new line following it:

$node = $vars['node'];
// Remove translation links
foreach ($node->links as $key => $value) {
  if ($value['attributes']['class'] == 'translation-link') {
    unset($node->links[$key]);
  }
}
$vars['links'] = theme('links', $node->links, array('class' => 'links inline'));

Once you've inserted the code, try clearing your cache so that Drupal finds the new function.

thx

the cache was the problem

/admin/settings/language/i18n

/admin/settings/language/i18n

I've got an option there called "Hide content translation links", which is what you want, isn't it?

I believe this is coming from i18n itself, althought I also have Language Icons and Consistent Language Interface. Both recommended.

Hide content translation links

Thank you frames, I have that option on my site as well. This means that I can remove the code that I had previously provided from the phptemplate_preprocess_node() function.

Cool

Glad to hear I helped.

Removing language link beneath content in Drupal 7

In Drupal 7 I removed it by unchecking/disabling the language in admin/config/regional/language.

Check 'hide content translation links'

In D7

/admin/config/regional/i18n/node

Hide content translation links
Hide the links to translations in content body and teasers. If you choose this option, switching language will only be available from the language switcher block.

Check this box and it will be removed... Easy, but hard to find :).

And how do I remove "language: English"?

Thanks for that advice. I would also like to remove the line, one above the link.
I could not find any settings for that, and I'm not sure who is writing that into my site...

Language
English

Just one more thing...

You need to have the i18n module option "Multilingual content" enabled for this checkbox to appear.

Found it

wildseven, To remove
Language
English

Go to "Manage Display" tab of your content type, and make the language field display "hidden" :)

nobody click here