Hi, first thanks for a very nice module. For the moment, I am just using the filter, but I like it's simple syntax and the ability to automatically insert the correct title.

However, I wondered if there is a way to include an image tag in stead of the description? So I could do like something this:

[100:<img src="path-to-file" />]

Or, alternatively, the field name of a CCK image and which Imagecache preset to use. That way, ML could automatically fetch the appropiate image according to the translation.

Comments

Andy Inman’s picture

Hi Lars,

Good idea, but no, currently it can't be done.

One difficulty may be the many different ways that images are handled (files, cck, Image module, etc.) Then consider: in some situations there would only be one image, valid for all translations - in others situations there would be a separate image per language. It starts to get complex and I think outside the scope of ML, or at least outside the scope of core ML functionality.

Maybe a good way to handle this would be to have a separate module to provide image links. Then ML could support that module in a similar way to the other supported modules (like PathFilter, InsertNode, etc.)

How do you handle this requirement currently?

LarsKramer’s picture

Hi netgenious, let me explain what I'm trying to accomplish: I want to make a block with an image that links to diiferent translations of a node. In the simplest case the image should be the same for all translations. So only the actual link to the node should change according to the interface language. If the link text is just plain text (or $), everything works fine. But I cannot insert an image because the image tags become quoted. I don't have much programming experience, but what I have found out is that this is probably due to the explanation here: http://api.drupal.org/api/function/l

'html' (default FALSE): Whether $text is HTML or just plain-text. For example, to make an image tag into a link, this must be set to TRUE, or you will see the escaped HTML image tag.

So I tried to include this option by modifing line 62 in multilink.module to this:
$options = array('html' => TRUE, 'external' => 1, 'attributes' => array('title' => $link->title));

Which seems to work. However, I don't know if this modifcation could have have some negative side effects...

I know I could just make a different block for each language (or manually translate the link with Translate Interface). I just think it would be cooler to have just one mulitlingual block with ML automatically showing the right link.

Regarding the second case, different images for each link: You are right, it would be out of scope. However, in the meantime I found another and more flexible solution to accomplish this: Views! I make a block display and select the translation set ID + Current language as filters, and as field a suitable image_cache preset of the node's imagefield linking to the node. Actually, this approach could also be applied to the first case.

Andy Inman’s picture

Ok, understood. Have you seen Language Sections? That's another way of having a single block display different content depending on the selected language. It won't automatically find the translations for you, you would have to know them in advance, but other than that it would allow you to do what you want, I think.

LarsKramer’s picture

Thanks for the tip. I had seen Language Sections, but never tried it. I got the impression that is was just an alternative to i18n for small sites. However, I will take a closer look. Some its feautures might be useful still. I noticed you are also the author :-)

For now, Drupal's handling of block translation is a bit awkward. Only way is to use the string translation system, and if you make changes in the source block, the translations might get lost. But using Views in combination with Select Translation is cool. That way you can make the original content in a node using CCK fields, translate the node, use Views to pick the content fields for showing in a block, and automatically have it translated with ST. I will do a little handbook page about it soon :-) I think many persons new to Drupal are not aware of this possibility.

BTW, I noticed your comment in languages in order of preference #1 about making a new module extending the user's language preferences. I have been thinking about that also for some time. It's really a fantastic idea! I don't have the programming skills to do it. But I will write to you about some ideas I have :-)

Andy Inman’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

See #833768 - there is a patch offered there which I think will allow you to do this.

Closing this.