Real Estate Website - Switching between different languages
2 posts by 2 authors in: Forums > CMS Builder
Last Post: October 10, 2013 (RSS)
By andybarn - October 8, 2013
I have searched the forums and cannot seem to find what I want.
I am looking for a code snippet to handle my website "switching" languages. My site www.kevinjonesvillas.com needs to switch between languages (currently Spanish and English but soon to be French and Russian.). I will have flags at the top of each page for each language.
I have kept to a simple sintax so that Spanish pages have “_es.php” on the end, French wil have “_fr.php” on the end and Russian “_ru.php”
Live English to Spanish Examples below:-
1)http://www.kevinjonesvillas.com/index.php =
http://www.kevinjonesvillas.com/index_es.php
2)http://www.kevinjonesvillas.com/about-kevin-jones-villas-costa-blanca.php =
http://www.kevinjonesvillas.com/about-kevin-jones-villas-costa-blanca_es.php
3)http://www.kevinjonesvillas.com/the-area-kevin-jones-villas-costa-blanca.php =
http://www.kevinjonesvillas.com/the-area-kevin-jones-villas-costa-blanca_es.php
4)http://www.kevinjonesvillas.com/property/listingDetail.php?KJV11615072-169 = http://www.kevinjonesvillas.com/property/listingDetail_es.php?KJV11615072-169
5)http://www.kevinjonesvillas.com/property/listingDetail_rentals.php?KJVR5004-338
http://www.kevinjonesvillas.com/property/listingDetail_rentals_es.php?KJVR5004-338
All the pages work, I have already carried out the translations.
What I need is a bit of code at the top of each page so that when I click the country flag, the new language page will be delivered depending on the flag clicked.
For instance, if I am on page
http://www.kevinjonesvillas.com/property/listingDetail_rentals.php?KJVR5004-338
and click the Spanish flag, I will then get the following Spanish page
http://www.kevinjonesvillas.com/property/listingDetail_rentals_es.php?KJVR5004-338
Thanks, any help appreciated.
Regards
Andy
By ross - October 10, 2013
Hi Andy
Thanks for posting!
My first idea on this is that because your page names are exactly the same except for the language specific part (ie: _es), you could just hardcode the URL's behind the flag. All you'd need to do is make sure and get the part after the ? to come through. That can usually be done with <?php echo $_SERVER['QUERY_STRING']; ?>
Does that make sense? Let me know if this answers your question.
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/