It is currently Thu Aug 21, 2014 9:59 pm Advanced search

Multiple languages

Technical support, bug reports, feature requests and more.

Multiple languages

Postby torstein.honsi » Mon Apr 06, 2009 8:28 am

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 Solutions
User avatar
torstein.honsi
Site Admin
 
Posts: 9197
Joined: Thu Nov 09, 2006 1:22 pm
Location: Vik i Sogn, Norway

Re: Multiple languages

Postby six gun » Mon Apr 06, 2009 9:37 am

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: Sun Apr 05, 2009 12:57 am

Re: Multiple languages

Postby six gun » Mon Apr 13, 2009 6:44 am

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. :?:
User avatar
six gun
 
Posts: 3
Joined: Sun Apr 05, 2009 12:57 am

Re: Multiple languages

Postby torstein.honsi » Tue Apr 14, 2009 11:39 am

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 Solutions
User avatar
torstein.honsi
Site Admin
 
Posts: 9197
Joined: Thu Nov 09, 2006 1:22 pm
Location: Vik i Sogn, Norway

Re: Multiple languages

Postby six gun » Tue Apr 14, 2009 5:37 pm

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!
User avatar
six gun
 
Posts: 3
Joined: Sun Apr 05, 2009 12:57 am

Re: Multiple languages

Postby torstein.honsi » Wed Apr 15, 2009 8:21 am

Great! You're welome.
Torstein Hønsi
CTO, Founder
Highsoft Solutions
User avatar
torstein.honsi
Site Admin
 
Posts: 9197
Joined: Thu Nov 09, 2006 1:22 pm
Location: Vik i Sogn, Norway

Re: Multiple languages

Postby PeterC » Wed Dec 14, 2011 3:41 am

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 } ?>
PeterC
 
Posts: 3
Joined: Wed Dec 14, 2011 3:37 am

Re: Multiple languages

Postby EarlyOut » Wed Dec 14, 2011 3:43 am

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

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

(etc.)

</script>
User avatar
EarlyOut
 
Posts: 1705
Joined: Sun Nov 11, 2007 11:22 pm
Location: Sector R

Re: Multiple languages

Postby PeterC » Wed Dec 14, 2011 10:54 pm

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?
PeterC
 
Posts: 3
Joined: Wed Dec 14, 2011 3:37 am

Re: Multiple languages

Postby RoadRash » Thu Dec 15, 2011 10:24 pm

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

Overview of my Highslide sample pages: RoadRash.no
User avatar
RoadRash
 
Posts: 8209
Joined: Tue Jul 15, 2008 8:43 pm
Location: Fredrikstad, Norway

Re: Multiple languages

Postby PeterC » Fri Dec 30, 2011 11:06 pm

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-add-multi-language-support-to-a-website.html
any ideas would be highly appreciated!!
PeterC
 
Posts: 3
Joined: Wed Dec 14, 2011 3:37 am

Re: Multiple languages

Postby RoadRash » Sat Dec 31, 2011 12:22 am

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
User avatar
RoadRash
 
Posts: 8209
Joined: Tue Jul 15, 2008 8:43 pm
Location: Fredrikstad, Norway


Return to Highslide JS Usage

Who is online

Users browsing this forum: No registered users and 2 guests