Return to Snippet

Revision: 51199
at September 16, 2011 18:49 by burconsult

Initial Code
$lang =& JFactory::getLanguage();
$locales = $lang->getLocale();
$locale = str_replace('-','_',substr($locales[0],0,5)); //This will get you "en_US" etc.

Initial URL

Initial Description
You can use this in Joomla extensions where you need to get the current language locale for example to use with Facebook Connect/Like plugins etc. in the "en_US" format. With facebooj JS, all you have to do is replace the default locale with the resulting variable something like this:

 e.src = document.location.protocol +'//<?=$locale?>/all.js';

Initial Title
Get Joomla language locale for use with Facebook js/fbml etc. on multilingual sites

Initial Tags
joomla, facebook

Initial Language