Is there a way to move translation links to the top right of each node, rather than the
default bottom position (mixed in with all the other links like 'comments', 'attachments' etc)?

I need the translation links to be more prominent and styled differently to the other links.

Thanks

Comments

aww’s picture

I found a solution in this post:

http://drupal.org/node/641194

-Anti-’s picture

Glad you found a solution. As you can see, moving the entire 'links' div is easy.

However, what I need to do is leave the 'read more', 'reply', 'X comments', etc links at the bottom,
and move only the translation language links to the top.

In other words, in addition to print $links, I'd like to be able to have something like:
print $languagelinks in my node-tpl.php.

I think it is important to have language links in the title metadata (along with author and post date).
It means users don't need to scroll down to the bottom of the node just to see if there is a translation.

diabolical’s picture

I'm trying to do the same thing but my php isn't so great. Ideally I want to show only 1 language link (I only have 2 languages) for the language that is not currently active. Looks like the relevant code is in locale.module, so might try some hacky stuff, and will let you know if successful.

diabolical’s picture

Involved some php and css hackery, but the following code in page.tpl.php should render your language link for the language not currenlty active (IE, when viewing english, only french link appears). Note you'll probably have to remove the comment lines and such.

<?php
	// this is copy&paste from locale_block in locale.module
	$languages = language_list('enabled');
	$links = array();
	foreach ($languages[1] as $language) {
	if ($language->language != $current) {
	$links[$language->language] = array(
	'href' => $_GET['q'],<br />
	'title' => $language->native,
	'language' => $language,
	'attributes' => array('class' => 'language-link'),
	);
	}
	}
       
	// this adds the real paths, i.e. if we are on a german page,
	// the british flag will point to en/english_alias instead of
	// en/node_with_german_content
	translation_translation_link_alter($links, $_GET['q']);
       
	// This one adds extended languages, i.e. those that are not enabled.
	// Disable if you want only flags for enabled languages.
	i18n_translation_link_alter($links, $_GET['q']);
       
	// now add or replace text links by flags, according to your i18n settings.
	if (function_exists('languageicons_translation_link_alter'))
	languageicons_translation_link_alter($links, $_GET['q']);
       
	// Or do your own stuff, e.g. set the flags and no lang names,
	// no matter what the i18n icon settings say.
	//if ($icon = theme('languageicons_icon', $language, NULL)) {
	// $links[$language->language]['title'] = theme('languageicons_place', $link['title'], $icon);
	// $links[$language->language]['html'] = TRUE;
	//}
       
	// remove the current language again. We cannot do that
	// earlier because i18n_translation_link_alter would add it
	// again, thinking it was an extendeg language because it
	// was not yet contained in $links. If you don't use
	// i18n_translation_link_alter, you can also make a case distinction
	// in the foreach loop
	$current = i18n_get_lang();
	unset($links[$current]);
       
	// format as you like, e.g.
	echo theme('links', $links, array());
?>
agrigor1’s picture

any idea how to remove the bullets and have them horizontally (without affecting the block in the sidebar)?

I guess it needs some css. Could you help me (i am newbee)?

not_Dries_Buytaert’s picture

Submitted this as a feature request: http://drupal.org/node/773642

cesar.brod@gmail.com’s picture

I wonder if someone has found a solution for this on D7. As described above, it would be nice to ave only the language links on top while still maintaining the other links as they are...

cesar.brod@gmail.com’s picture

Still looking for a solution for this...