Sino Thomas
Sino Thomas

Reputation: 141

joomla 2.5 set language using code

I am using joomla 2.5.4 and Virtuemart 2.0.6, I want to change the language of the site when some users are login. I want to set the langauge using code not by any joomla settings.

Please help me.

Upvotes: 0

Views: 2058

Answers (1)

Arun
Arun

Reputation: 685

You could set the tag from a cookie, or pass it from elsewhere, this is just a hardcoded example.

/* Set your tag */
$tag = 'es-ES';
/* Set your extension (component or module) */
$extension = ‘com_yourcomponent’;
/* Get the Joomla core language object */
$language =& JFactory::getLanguage();
/* Set the base directory for the language */
$base_dir = JPATH_SITE;
/* Load the language */
$language->load($extension, $base_dir, $tag, true);

Referance:http://danmrichards.wordpress.com/2011/02/24/change-joomlas-language-at-run-time/

Upvotes: 1

Related Questions