Posted By

burconsult on 09/16/11


Tagged

language joomla facebook locale


Versions (?)

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


 / Published in: PHP
 

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 +'//connect.facebook.net//all.js';

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

Report this snippet  

You need to login to post a comment.