Multilingual text of "save image link" in slimbox

Phoca Gallery - image gallery extension
get12
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 25 Dec 2011, 21:59

Multilingual text of "save image link" in slimbox

Post 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
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49150
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

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

Post by Jan »

Hi, you cannot use Joomla! JText PHP method in Javascript, there you need to set fixed string :-(

Jan
If you find Phoca extensions useful, please support the project
get12
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 25 Dec 2011, 21:59

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

Post 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?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49150
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

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

Post 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
If you find Phoca extensions useful, please support the project
Post Reply