Hi all,

I'm using this fantastic module, but I noticed that it lacks in i18n compatibility.

Specifically, if I made a translation of a block title (linked) in other languages, the term itself results translated, but its link disappear in translations.

How I can keep the title link in other languages? And also I think there would be the possibility to translate also the destination "href" for each language.

Thank you very much for your work, and sorry for my bad english

MXT

Comments

ngmaloney’s picture

Assigned: Unassigned » ngmaloney
Status: Active » Needs work

I'll look into adding i18n compatibility. Could this be achieved by adding a t() around the url variable?

mxt’s picture

May be.

What I have now if I make a string research for my block title in the translation interface management, I'll obtain the title itself to translate, without any < a > html tag.

I think that the result for translating string have to return all the html, like this for example:

<a href="www.address-default" title="default-link-title">My Block Default Title</a>

In this way I'll be able to translate everything for other available languages, for example:

ITALIAN:

<a href="www.address-ITALIAN" title="ITALIAN-link-title">My Block ITALIAN Title</a>

Do you think it could be a way to proceed ?

Thank you

mxt’s picture

Priority: Normal » Major

I think this issue has to be marked as MAJOR because, de facto, this module doesn't work in multilingual websites.

Link on blocks title disappear at all in translated version of blocks.

Thank you very much.

ngmaloney’s picture

The title attribute and anchor text should be easy, as I think wrapping them in a t() would work. I don't know the best approach for having multi-language URL's. Can the path in an l() be wrapped in t()? If not, how do other contrib modules handle translating URL's?

ngmaloney’s picture

@MXT would you be able to roll a patch with suggestions on how to resolve?

mxt’s picture

Ooops Ngmaloney, i think there's a misunderstanding: I'm not a programmer! So I can't do a patch... My only contribute here to this Community is reporting issues, testing and so on... :-(

Anyway, I think using t(l(....)) may be the right solution, but I can't know if it would be the best approach to resolve this kind of issues, sorry...

Thank you for your work.

ngmaloney’s picture

Status: Needs work » Needs review

@MTX - Try this http://c0532142.cdn.cloudfiles.rackspacecloud.com/block_titlelink.tgz I added t() around the title and urls. If it works let me know and I'll patch and release to the 6.x build.

zzadik’s picture

Until this get's resolved I've found a pretty easy solution which doesn't involve patching the module.
In my theme's block template file (block.tpl.php), I've translated the block's subject.
Please see the example below (I've used Garland for this example):

<div id="block-<?php print $block->module .'-'. $block->delta; ?>" class="clear-block block block-<?php print $block->module ?>">
<?php if (!empty($block->subject)): ?>
	<?php $block->subject = l(t($block->subject), $block->title_link, array('attributes' => array('class' => 'block-title-link'), 'html'=>'true'));?>
  <h2><?php print $block->subject ?></h2>
<?php endif;?>

  <div class="content"><?php print $block->content ?></div>
</div>
ngmaloney’s picture

@zzadik thanks for the code. That is essentially how the #7 patch I posted works. Would you mind testing it?

zzadik’s picture

@ngmaloney, I tried the code, but for some reason I got numerous errors and didn't have the time to analyze their source. Had to choose the easier path for now

quazardous’s picture

try to just set the weight of block_title_link module greater than i18n_blocks module...

EDIT : actualy working

alexbk66-’s picture

@quazardous, great! Changing module weight works!

ngmaloney’s picture

Status: Needs review » Closed (fixed)

Closing as it seems changing module weight (#11) fixes problem.