Theming the language switcher block

www.richardspro... - April 11, 2008 - 15:02

I want the language switcher block that comes with the i18n module to look different.

I would like it to be a list and not include the pictures of flags.

Is there a way of theming it such as with a block-i18n.tpl.php file.

Thanks.

Richard.

Fixed it!

www.richardspro... - April 11, 2008 - 15:39

Right I managed to figure it out and I thought I'd share.

You can theme the outside of the language switcher block using block-i18n-0.tpl.php

To change how the links were displayed I added the following function to template.php

<?php
/**
* Theme my language switcher links
*/
function phptemplate_i18n_link($text, $target, $lang, $separator='&nbsp;') {
 
$attributes = ($lang == i18n_get_lang()) ? array('class' => 'active') : NULL;
 
$output .= l($text, $target, $attributes, NULL, NULL, FALSE, TRUE);
  return
$output;
}
?>

I found this post very helpful:
www.drupal.org/node/117201

Richard Garside
www.richardsprojects.co.uk

 
 

Drupal is a registered trademark of Dries Buytaert.