If you'd like to let visitors select their language on your site, do the following in your index.php file



$lang_request = JRequest::getWord('lang');
$lang_choice = implode("-", str_split($lang_request, 2));
$currentSession = JFactory::getSession();

if(!empty($lang_choice))
{
$currentSession->set("langChoice",$lang_choice);
$lang =& JFactory::getLanguage();
$lang->setLanguage( $lang_choice );
$lang->load();
}
elseif($currentSession->getState())
{
$lang =& JFactory::getLanguage();
$lang->setLanguage( $currentSession->get("langChoice") );
$lang->load();
}



when user clicks on a link have your url like the following:
http://www.yoursite.com/?lang=de-DE or /?lang=en-GB

the lang would be stored in session so you don't need to worry about it anymore.

0 comments



Some Links (off programming)