?
avatar ervindeak
ervindeak
4 Nov 2020

Steps to reproduce the issue

Try to load a frontend language file from a plugin running on backend. Error occurs when a backend language file already loaded. Language::getPaths returns something, because there's another file for the same extension.

Expected result

Nice translated text.

Actual result

Language constant.

System information (as much as possible)

Joomla 3.9.22, PHP 7.4

Additional comments

If I trying to use $this->loadLanguage('com_something', JPATH_SITE) in my plugin AND com_something's ADMIN language file is already loaded, CMSPlugin::loadLanguage skips loadig, because it doesn't check if $basePath matches or not.

CMSPlugin.php, from line 140:

		// If language already loaded, don't load it again.
		if ($lang->getPaths($extension))
		{
			return true;
		}

avatar ervindeak ervindeak - open - 4 Nov 2020
avatar joomla-cms-bot joomla-cms-bot - change - 4 Nov 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 4 Nov 2020
avatar zero-24
zero-24 - comment - 5 Nov 2020

Good morning, can you provide a Patch and send it against the staging branch on GitHub?

And for the testers a quick Test extension showcasing the problem would be great.

avatar ervindeak
ervindeak - comment - 5 Nov 2020

Digging into Joomla\CMS\Language I found out checking if the language file already loaded in CMSPlugin is unnecessary because Language::load() also checks it, and does a better work.

avatar zero-24
zero-24 - comment - 5 Nov 2020

Great. Will close than here as we now have your PR #31312 can you extend that description with some testing instructions?

Thank you

avatar zero-24 zero-24 - change - 5 Nov 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-11-05 08:22:15
Closed_By zero-24
avatar zero-24 zero-24 - close - 5 Nov 2020

Add a Comment

Login with GitHub to post a comment