Feature bug PR-5.2-dev Pending

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
10 Apr 2023

Summary of Changes

Alernative to #40309
The patch moves language loading out from CMSPlugin constructor.
This makes the constructor lighter and probably esier for tests, also allows to restore #27155.

Testing Instructions

Apply patch, and make sure all works as before. All plugins translated.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org: IDK
  • No documentation changes for docs.joomla.org needed
  • No documentation changes for manual.joomla.org needed
  • Pull Request link for manual.joomla.org: IDK
avatar joomla-cms-bot joomla-cms-bot - change - 10 Apr 2023
Category Libraries
avatar Fedik Fedik - open - 10 Apr 2023
avatar Fedik Fedik - change - 10 Apr 2023
Status New Pending
avatar Fedik Fedik - change - 10 Apr 2023
The description was changed
avatar Fedik Fedik - edited - 10 Apr 2023
avatar Fedik Fedik - change - 23 Apr 2023
Title
Move language autoload out from CMSPlugin constructor
[5.0] Move language autoload out from CMSPlugin constructor
avatar Fedik Fedik - edited - 23 Apr 2023
avatar HLeithner HLeithner - change - 21 Jul 2023
The description was changed
avatar HLeithner HLeithner - edited - 21 Jul 2023
avatar HLeithner
HLeithner - comment - 22 Jul 2023

I think it's not a good idea to force the application in the plugin to load the languages, wouldn't it be better to provide the language in the register process?

avatar Fedik
Fedik - comment - 22 Jul 2023

Accessing language in constructor of the System plugins should be forbiden (and for any other group also).
Because the Language available not early than afterInitialise.
That will limit the plugin usage, and will not allow to use it for early stages. And this is a main reason why I tries to move language loading out from constructor ;)

avatar Fedik Fedik - change - 6 Aug 2023
Labels Added: Feature bug PR-5.0-dev
avatar ceford ceford - test_item - 14 Sep 2023 - Tested successfully
avatar ceford
ceford - comment - 14 Sep 2023

I have tested this item ✅ successfully on 2bf6090

I applied patch, logged in with German selected and opened several plugins - all strings were in German. Is that a valid test?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40355.

avatar HLeithner
HLeithner - comment - 17 Sep 2023

I'm not so happy to merge this in to 5.0 anymore, since it would effect existing plugins depending for the loaded language in the constructor. I think we have to postpone this to 6.0 or find a better b/c way.

avatar Fedik
Fedik - comment - 18 Sep 2023

Yeah, it would be need before first alpha :)

But I thinking to moving it in to bootPlugin(), will be smarter.

if ($plugin->autoloadLanguage()) {
  ... here some code for checking if language is ready, then:  
  $plugin->loadLanguage();
}

For 6 or maybe can get in one of 5.x.
Loading language in the plugin constructor is very bad.

avatar HLeithner
HLeithner - comment - 30 Sep 2023

This pull request has been automatically rebased to 5.1-dev.

avatar HLeithner HLeithner - change - 24 Apr 2024
Title
[5.0] Move language autoload out from CMSPlugin constructor
[5.2] Move language autoload out from CMSPlugin constructor
avatar HLeithner HLeithner - edited - 24 Apr 2024
avatar Fedik Fedik - change - 28 Apr 2024
Labels Added: PR-5.2-dev
Removed: PR-5.0-dev
avatar Fedik
Fedik - comment - 28 Apr 2024

I have changed approach, should be better now.

avatar HLeithner
HLeithner - comment - 2 Sep 2024

This pull request has been automatically rebased to 5.3-dev.

avatar HLeithner HLeithner - change - 2 Sep 2024
Title
[5.2] Move language autoload out from CMSPlugin constructor
[5.3] Move language autoload out from CMSPlugin constructor
avatar HLeithner HLeithner - edited - 2 Sep 2024

Add a Comment

Login with GitHub to post a comment