SOLUTION - Force loading of Joomla! backend global language file in your extensions

Force loading of Joomla! backend global language file in your extensions

Hello super joomlers!

Sorry for being so quiet for so long. I'm back with a new present for you: How to load global language file from your Joomla! site in any of your custom extensions. Are you a Joomla! extension developer? You might have had, just like me,  that same  problem when coding your extension.

How to load the language file fr-FR.ini oren-GB.ini found there:
JPATH_ADMINISTRATOR/language/en-GB/en-GB.ini
JPATH_ADMINISTRATOR/language/fr-FR/fr-FR.ini
or
JPATH_SITE/language/en-GB/en-GB.ini
JPATH_SITE/language/fr-FR/fr-FR.ini
In your extensions and force usage of thoses files, in order to, for example, display correctly translated buttons in a toolbar (the same that is in admin panel on Joomla! frontend).For those of you who are interested, here is the code the force the loading of global language coming from Joomla! backend:


       // Force loading of backend global language file
	$language = Factory::getLanguage();
	$language->load('joomla', JPATH_ADMINISTRATOR);

No thoughts on “SOLUTION - Force loading of Joomla! backend global language file in your extensions”

Alexandre ELISÉ

Développeur #PHP spécialiste #Joomla! Si mon travail vous a plu n'hésitez pas à laisser votre avis sur Google Reviews. Si mes articles vous ont été utiles vous pouvez me le dire avec Paypal.me ça m'encourage à continuer et me permet de savoir que vous apprecier le contenu. Sinon vous pouvez toujours m'envoyer un email pour me faire part de vos suggestions.

Get the newsletter

Super Joomlers! Get the most out of Joomla!
We hate spam as much as you do and we will not send you email without your prior consent. You can unsubscribe / resubscribe any time you want.