Switch languages

4 posts by 2 authors in: Forums > CMS Builder
Last Post: December 8, 2009   (RSS)

I know how to create a multilingual site using CMS builder by creating a field for each language but how can the user switch to one of the other languages once on the site. Lets say the user is navigating through the site and lands on a product page but now wants to see that product in one of the other languages. Is there a way that the user can just simply switch languages on the fly no matter what page they are on? I hope that I'm clear.

Re: [Dan Maitland] Switch languages

By ross - December 8, 2009

Hi Dan

Thanks for posting!

Because there are several ways to setup CMS Builder for using multiple languages, we should go over how you have yours setup.

From experience, I find it works best if you only have one record for each item you create but it has several fields on it for all the different languages.

Could you let me know if this is how you have it set up too? If not, how do you have it setup?

Thanks!
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [Dan Maitland] Switch languages

By ross - December 8, 2009

Hi Dan

Great!

The next step is going to be making several copies of your display template like this:

displayPageEnglish.php
displayPageFrench.php
displayPageSpanish.php

You can use any name you like as long as you know which one is which. Of course, on those pages, you would display the appropriate pages for each language.

To link between the templates but still keep the same record displaying, you can use something like this:

<a href="displayPageEnglish.php?num=<?php echo $record['num']; ?>">English</a>

<a href="displayPageFrench.php?num=<?php echo $record['num']; ?>">French</a>

<a href="displayPageSpanish.php?num=<?php echo $record['num']; ?>">Spanish</a>

Do you see how that works? You are basically just linking to the different pages but using the same record number each time. You'll need to make sure you change "$record" so it matches your page.

Give it a shot and let me know how you make out :).

Thanks!
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/