Few days ago I was trying to include Joomla multilanguage system in my Simple Download Counter for Joomla 3 plugin. And I found that if I use string, which I override manually in  Extensions - Languages - Overrides menu , JText::_('Our overriden constant'); work fines. But if I set constant in LANG file of my extension and tried JText - I got zero result. So I decided to include Joomla 3 multilanguage system support in my plugin manually. 

What I`ve done, in my plugin firstly I get JFactory::getLanguage();

$lang = JFactory::getLanguage();

Then you must specify your plugin system name and from which Joomla language folder you want JText to look your language constants. JPATH_ADMINISTRATOR for administrator/language/ or JPATH_SITE /language. 

$lang->load('plg_content_sdc',JPATH_ADMINISTRATOR);

And now you can test it

echo JText::_('PLG_CONTENT_SDC_SITE_DOWNLOAD_TEXT');

Can anyone give me a better solution? smile

If you like this - share it with your friends. That would be the best "donation" for me!

If you want to ask question or comment - login by using your favourite social network

Add comment