Version 3.0.3 and multilingual websites

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Version 3.0.3 and multilingual websites

TheWolf1
Hello!

I like the new version 3 but I have a problem. My website is in French and English. With previous versions I had to load the correct lang.js file (if my memory is correct). Now I must download the library twice and load the correct version. I don't like to have to download the tool twice when the only difference between the two is the S.lang variable (which contains all the strings of the tool).

Is there a way to change the content of S.lang dynamically with JavaScript (without having to change the Shadowbox sources). This way I can change the Shadowbox strings (because I don't like some traductions) without having to download the tool more than once and more importantly only have one file to update at each SB updates...

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Version 3.0.3 and multilingual websites

TheWolf1
This post was updated on .
OK, I found out by myself. Posting out for others...

All you have to do is to change the Shadowbox.lang values like this:

    <script type="text/javascript">
        //This $hitty board is validating URLs even in "raw" tags, replace occurences of href="#" by href="{#}" in the next line.
        Shadowbox.lang={code:"en",of:"of",loading:"loading CUSTOM",cancel:"Cancel",next:"Next",previous:"Previous",play:"Play",pause:"Pause",close:"Close",errors:{single:'You must install the <a href="0">{1}</a> browser plugin to view this content.',shared:'You must install both the <a href="0">{1}</a> and <a href="2">{3}</a> browser plugins to view this content.',either:'You must install either the <a href="0">{1}</a> or the <a href="2">{3}</a> browser plugin to view this content.'}};
        Shadowbox.init();
    </script>
Reply | Threaded
Open this post in threaded view
|

Re: Version 3.0.3 and multilingual websites

xuan-minh
Thanks a MILLION, TheWolf! This is certainly going to come in handy. Off to test now...
Reply | Threaded
Open this post in threaded view
|

Re: Version 3.0.3 and multilingual websites

xuan-minh
Finally got around to test your idea. Unfortunately that won't fit my purpose that well, since we use Shadowbox in a CMS that supports multi-language websites. We should be able to pass on a language variable dynamically, just like in the old Shadowbox.

Too bad the language file concept was abandoned. I thought that was an excellent feature, and this is certainly not encouraging us to upgrade. Language support should stay backwards compatible in my opinion.

Just a thought!
Reply | Threaded
Open this post in threaded view
|

Re: Version 3.0.3 and multilingual websites

HenzeBerkheij
well, using php?? if ($lang == EN){ print englishString }else if($lang==NL){print dutchString} etc ??

or put the javascript in your own lang.js file and load it in after including shadowbox.js and before the init by printing <?=$lang?>lang.js or something like that in the script tag...

Reply | Threaded
Open this post in threaded view
|

Re: Version 3.0.3 and multilingual websites

xuan-minh
Thanks, Henze,

but we don't use PHP. I ended up using Wolf's approach, together with our dynamic locale lang variable and text resources engine.