Is it possible to have different overlay different by page language ?

Comments

fietserwin’s picture

Status: Active » Closed (won't fix)

No, there is not necessarily a page context when images get created. See e.g.: #1967544: Make text "Hello World!" to be multilingual variable.

etron770’s picture

Status: Closed (won't fix) » Active

What about the url path? .../en/... .../fr/... etc?
Do you have any hints at what code function (line) I can look for to implement it?
Maybe it is possible to set a checkbox for language support yes no and the detect the language by path.

I am using this overlay in a slide box and it would be very helpful to get any kind of language detection

dman’s picture

Status: Active » Closed (works as designed)

Does your path to the image file when it is requested from the server really include the /en/ prefix?
I've never seen a setup like that - what modules are you using that makes that happen? If you can manage that, then you do have a chance.

What really happens at the imagecache_actions level is explained in the link fietserwin gave, or more specifically in #642048: No, you can't pass 'arguments' to imagecache_actions. Here's why
Generated images are generated once and cached. This means that if a German browser and a French browser ask for exactly the same URL, and the derivative does not exist, the image will be generated the first time and saved. Every request from then on will get the generated image.
Even if you could use a custom_action to pick up the browser language cookie (possible) - Once generated, the same file is served next time, and no logic is processed for the second visitor that asks for the image.

Other solutions to what you ask may be possible, but they need to be initiated from the page-rendering level, and ask for different versions of the image at the HTTP request level. Imagecache_actions starts doing its thing after the page is built and a named image is requested. The HTTP request comes with very little context.

It's an OK request to try and support different images (or different derivatives of images) for different languages ... but that would have to happen in a different (rendering-type) module.

etron770’s picture

No, the image file does not include the /en/ prefix.
I thought about making a patch which would determinate the language path and then add the language to the overlay path.
means f.e the path is f.e ../files/foo/overlay.png

the patch would add the prefix to ../files/en/foo/overlay.png

The slides must added before by ftp of course.

I added the overlays directly to the images of the sideshow and now I can have different images by language. It more easy than to patch any module ;-)

dman’s picture

Based on this issue, I did go off and experiment with adding 'context.module' support to the image renderer.
The idea being that if a context string was available (which encompasses lang, but maybe also more, like anon vs registered user,) then the image *rendering* phase in the HTML could choose a different image variation, or one of those variations with a *static* argument passed to it - and would/could be stored in a different path like you say.

But it got complex quick.

ANYWAY - as you've found, modern methods that use real HTML text and render it as overlays with groovier CSS is a better idea all-round. That's sort of why I've not put personally lots of time into adding more text actions in the last 3 years :-)

.dan.