Page 1 of 1

Multilingual text of "save image link" in slimbox

Posted: 10 Feb 2012, 20:00
by get12
Hello,

I use phoca gallery component. And slimbox for images detail view.

I have set up an option to download images from detail view in slimbox.
I did that by adding additional code to slimbox.js, as suggested on official web-site:

Code: Select all

 // AUTOLOAD CODE BLOCK (MAY BE CHANGED OR REMOVED)
Slimbox.scanPage = function() {
        $$($$("a").filter(function(el) {
                return el.rel && el.rel.test(/^lightbox/i);
        })).slimbox({/* Put custom options here */}, function(el) {
                return [el.href, el.title + '<br /><a href="' + el.href + '">Download this image</a>'];
        }, function(el) {
                return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
        });
};

window.addEvent("domready", Slimbox.scanPage);
But in this case, the "save image" text is displayed in English.
Can you please suggest, how can I insert a translatable variable, instead of "Download this image"?

UPD

I asked same question on joomla forum and was advised to do the following:

Code: Select all

In the INI file you have: COM_EXMAPLE_DOWNLOAD_THIS="Download this image"
In the view file (view.html.php) you put: JText::script('COM_EXMAPLE_DOWNLOAD_THIS');
In the JS file you put Joomla.JText._('COM_EXMAPLE_DOWNLOAD_THIS')
But there are lots of view.html.php in gallery component, so I don't really know wich one to modify.
here is the link of discussion http://forum.joomla.org/viewtopic.php?f=617&t=694917

Re: Multilingual text of "save image link" in slimbox

Posted: 10 Feb 2012, 22:30
by Jan
Hi, you cannot use Joomla! JText PHP method in Javascript, there you need to set fixed string :-(

Jan

Re: Multilingual text of "save image link" in slimbox

Posted: 12 Feb 2012, 15:38
by get12
OK, I got your idea.
We cannot use JText PHP method in Javascript.
Is there any other possibility to include a translatable variable in Javascript?

Re: Multilingual text of "save image link" in slimbox

Posted: 13 Feb 2012, 12:39
by Jan
Hi, I think not, until you will translate the js file to php and include it to Joomla! framework, so the javascript will be outputed with help of php and will directly show the right language :-(

Jan