torstein.honsi
Site Admin
Posts: 9215
Joined: Thu Nov 09, 2006 11:22 am
Location: Vik i Sogn, Norway

Multiple languages

six gyn wrote:Some time ago mention was made of how to apply coding to enable language switches in Highslide

if (lang == 'cz') {
hs.lang = {
loadingText : 'Načítá se...',
[...]
};
} else {
hs.lang = {
loadingText : 'Loading',
[...]
};
}

I have tried several times to apply this if else conditional statement.

The top end of highslide.js is

var hs = {
// Language strings
lang : {
cssDirection: 'ltr',
loadingText : 'Loading...',
loadingTitle : 'Click to cancel',
focusTitle : 'Click to bring to front',

(missing code)

fullExpandText : '1:1',
number: 'Image %1 of %2',
restoreTitle : 'Click to close image, click and drag to move. Use arrow keys for next and previous.'
},

My knowledge of javascript is not good enough to apply this.
I note the section of code in the suggestion end with ;
whereas in the actual file it is ,
Additionally the top end of the section is

var hs = {
// Language strings
lang : {

which differs to the code needed in the if else statement.

Would anyone help me in my ignorance.
I would love to be able to switch languages -
By the way I use Joomla and Joomfish
This code is correct:
if (lang == 'cz') {
hs.lang = {
loadingText : 'Načítá se...',
[...]
};
} else {
hs.lang = {
loadingText : 'Loading',
[...]
};
}
If it doesn't work for you, please post the link to a live web page and we'll help you debug it.

Another options, since you are using this in a Joomla environment, is to do the language selection on the server side using PHP and predefined JoomFish language strings.
Torstein Hønsi
CTO, Founder
Highsoft
User avatar
six gun
Posts: 3
Joined: Sat Apr 04, 2009 10:57 pm
Contact: Website

Re: Multiple languages

I'll try this out - thanks for the prompt reply.

Joomfish - redefined language strings!
I would love that - but my knowledge of php implementation is not that good yet.
User avatar
six gun
Posts: 3
Joined: Sat Apr 04, 2009 10:57 pm
Contact: Website

Re: Multiple languages

Well I finally managed it.
Not as elegant as I had hoped.
I used conditional states in the template index.php file to write the pathways to the javascript files, which then varied with the site language operating.

I have translated everything but I am struggling with last bit.
The accented text does not render properly, so I have replaced it with code.

This works in all cases except with the tooltip message in French for the enlarged image.
Eg
"Click to close image, click and drag to move. Use arrow keys for next and previous."

or rather
'Cliquer pour fermer l\'image, cliquer et faire glisser pour déplacer, utiliser les touches flèches droite et gauche pour suivant et précédent.'

"é" appears on the screen as is and not ├®
Code has to be used as the accented letters appear as squares otherwise.
I have saved the javascript file in UTF-8 without BOM
I am running a database with is collated UTF-8_general_ci
French is the only language I am using at the moment that has an accented letter with the tooltip text.
There is something about this overlib for the enlarged image. All the other French is perfect - accents and all.

Any advice welcome. :?:
torstein.honsi
Site Admin
Posts: 9215
Joined: Thu Nov 09, 2006 11:22 am
Location: Vik i Sogn, Norway

Re: Multiple languages

It does work with accents in the title attribute when everything runs as UTF-8. See http://highslide.com/studies/accents.html . Make sure the meta tag of your page is correct.

Code: Select all

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Torstein Hønsi
CTO, Founder
Highsoft
User avatar
six gun
Posts: 3
Joined: Sat Apr 04, 2009 10:57 pm
Contact: Website

Re: Multiple languages

Hmmmm....

Sometimes things work when they should not
And sometimes they don't work when they should.

My site is Joomla 1.5
It is standard for it to be UTF-8
The database and every table in it is collated UTF-8 general-ci
My accented letters were coded
I have saved my javascript in UTF-8 without BOM

And still it did not work for me ..... :cry:

I went to the page you referenced - it was in French - accents and all.

I copied it out from the source - not special coding here - I pasted it into my French javascript file - I saved it in UTF-8 without BOM.

Now it is working perfectly.
I think it must be the master's touch.
Thanks for the help!
torstein.honsi
Site Admin
Posts: 9215
Joined: Thu Nov 09, 2006 11:22 am
Location: Vik i Sogn, Norway

Re: Multiple languages

Great! You're welome.
Torstein Hønsi
CTO, Founder
Highsoft
PeterC
Posts: 3
Joined: Wed Dec 14, 2011 1:37 am

Re: Multiple languages

Hi there! First of all, great tool and great support!! Thanks a lot!
I can't seem to get the multilanguage hs.lang to work where exactly do I have to put this code?

Example: German and English language support

Code: Select all

<?php if ($lang == 'de') { ?>
   hs.lang = {
   loadingText :     'Lade...',
   loadingTitle :    'Klick zum Abbrechen',
   focusTitle :      'Klick um nach vorn zu bringen',
   fullExpandTitle : 'Zur Originalgr├Â├ƒe erweitern',
   fullExpandText :  'Vollbild',
   creditsText :     'Powered by <i>Highslide JS</i>',
   creditsTitle :    'Gehe zur Highslide JS Homepage',
   previousText :    'Voriges',
   previousTitle :   'Voriges (Pfeiltaste links)',
   nextText :        'Nächstes',
   nextTitle :       'Nächstes (Pfeiltaste rechts)',
   moveTitle :       'Verschieben',
   moveText :        'Verschieben',
   closeText :       'Schließen',
   closeTitle :      'Schließen (Esc)',
   resizeTitle :     'Gr├Â├ƒe wiederherstellen',
   playText :        'Abspielen',
   playTitle :       'Slideshow abspielen (Leertaste)',
   pauseText :       'Pause',
   pauseTitle :      'Pausiere Slideshow (Leertaste)',
   restoreTitle :    'Klick um das Bild zu schließen, klick und ziehe um zu verschieben. Benutze Pfeiltasten für vor und zurück.'
};
   
<?php } else { ?>
    hs.lang = {
  loadingText : 'Loading...',
	loadingTitle : 'Click to cancel',
	focusTitle : 'Click to bring to front',
	fullExpandTitle : 'Expand to actual size (f)',
	creditsText : 'Powered by <i>Highslide JS</i>',
	creditsTitle : 'Go to the Highslide JS homepage',
	previousText : 'Previous',
	nextText : 'Next', 
	moveText : 'Move',
	closeText : 'Close', 
	closeTitle : 'Close (esc)', 
	resizeTitle : 'Resize',
	playText : 'Play',
	playTitle : 'Play slideshow (spacebar)',
	pauseText : 'Pause',
	pauseTitle : 'Pause slideshow (spacebar)',
	previousTitle : 'Previous (arrow left)',
	nextTitle : 'Next (arrow right)',
	moveTitle : 'Move',
	fullExpandText : '1:1',
	number: 'Image %1 of %2',
	restoreTitle : 'Click to close image, click and drag to move. Use arrow keys for next and previous.'
};
<?php } ?>
User avatar
EarlyOut
Posts: 1705
Joined: Sun Nov 11, 2007 9:22 pm
Location: Sector R
Contact: Website

Re: Multiple languages

It's Javascript, so surround those settings with script tags:

Code: Select all

<script type="text/javascript">
hs.lang = {
loadingText: ....

(etc.)

</script>
PeterC
Posts: 3
Joined: Wed Dec 14, 2011 1:37 am

Re: Multiple languages

Thanks for the quick reply!

It still doesnt work..

I put the following code in the head section of my php site:

Code: Select all

<?php if ($lang == 'de') { ?>
<script type="text/javascript">
hs.lang = {
loadingText : 'Lade...',
loadingTitle : 'Klick zum Abbrechen',
focusTitle : 'Klick um nach vorn zu bringen',
fullExpandTitle : 'Zur Originalgr├Â├ƒe erweitern',
fullExpandText : 'Vollbild',
creditsText : 'Powered by <i>Highslide JS</i>',
creditsTitle : 'Gehe zur Highslide JS Homepage',
previousText : 'Voriges',
previousTitle : 'Voriges (Pfeiltaste links)',
nextText : 'Nächstes',
nextTitle : 'Nächstes (Pfeiltaste rechts)',
moveTitle : 'Verschieben',
moveText : 'Verschieben',
closeText : 'Schließen',
closeTitle : 'Schließen (Esc)',
resizeTitle : 'Gr├Â├ƒe wiederherstellen',
playText : 'Abspielen',
playTitle : 'Slideshow abspielen (Leertaste)',
pauseText : 'Pause',
pauseTitle : 'Pausiere Slideshow (Leertaste)',
restoreTitle : 'Klick um das Bild zu schließen, klick und ziehe um zu verschieben. Benutze Pfeiltasten für vor und zurück.'
};
</script>

<?php } else { ?>
<script type="text/javascript">
hs.lang = {
loadingText : 'Loading...',

--etc. --

</script>
the language does not change though..
any ideas?
User avatar
RoadRash
Posts: 8249
Joined: Tue Jul 15, 2008 6:43 pm
Location: Fredrikstad, Norway
Contact: Website

Re: Multiple languages

The code must be included after the highslide js file.
Hilde
Highslide Support Team

Overview of my Highslide sample pages: RoadRash.no
PeterC
Posts: 3
Joined: Wed Dec 14, 2011 1:37 am

Re: Multiple languages

Thanks a lot!!
The highslide language does finally change!
For some reason, however, it also changes the rest of website text and displays the letter "d" everywhere instead of the text.
i'm trying to implement a multi-language website using the following procedure:
http://www.bitrepository.com/php-how-to ... bsite.html
any ideas would be highly appreciated!!
User avatar
RoadRash
Posts: 8249
Joined: Tue Jul 15, 2008 6:43 pm
Location: Fredrikstad, Norway
Contact: Website

Re: Multiple languages

IÔÇÖm sorry; this is a dedicated Highslide JS support forum. You need to ask for help with the PHP multi-lingual script somewhere else.
You should probably get your multi-lingual website running correct before you implement multiple languages for Highslide.
Hilde
Highslide Support Team

Overview of my Highslide sample pages: RoadRash.no

Return to “Highslide JS Usage”