joomla-cms icon indicating copy to clipboard operation
joomla-cms copied to clipboard

[5.2] Mail Templates language file loading not using the MailsHelper::loadTranslationFiles

Open zero-24 opened this issue 1 year ago • 12 comments

Summary of Changes

Load the template language files via the MailsHelper over an manuall code which not handles it correctly for example for plugins.

Testing Instructions

  1. Install this extension: https://github.com/zero-24/plg_task_extensionupdates/releases
  2. check the mail templates (system -> Mail Templates -> Extensions Update Notification)
  3. notice that the mail template is not translated
  4. apply this patch
  5. notice the templates are now translated
  6. check other mail templates
  7. confirm they are also still translated

Actual result BEFORE applying this Pull Request

On the detail view an mail template shipped with an plugin is not translated image

Expected result AFTER applying this Pull Request

Once that patch is applied the issue is solved image

Link to documentations

Please select:

  • [x] No documentation changes for docs.joomla.org needed
  • [x] No documentation changes for manual.joomla.org needed

zero-24 avatar May 15 '24 00:05 zero-24

I have tested this item :red_circle: unsuccessfully on 3ccce67f8be731eeb3d0c02da3e886d30cf0fbf5

After applying the patch i see:

An error has occurred. 0 Class "Joomla\Component\Mails\Administrator\View\Template\MailsHelper" not found

Seems like this line is missing. use Joomla\Component\Mails\Administrator\Helper\MailsHelper;


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

JeroenMoolenschot avatar May 23 '24 08:05 JeroenMoolenschot

Yes sorry i have added it to my test Installation but not to the patch. Its added now, please try again. Thanks

zero-24 avatar May 23 '24 08:05 zero-24

I have tested this item :red_circle: unsuccessfully on c903f7c91401988f62f28bf5a27146957ae3b9ea

The added line solved the error indeed.

But after applying the patch, the subject and bodytexts are only in English, even when i select the German flag for example. This occurs to all mailtemplates, not only plg_task_extensionupdates


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

JeroenMoolenschot avatar May 23 '24 08:05 JeroenMoolenschot

Hmm need to look into this deeper later. When its happening with and without the patch it looks like a different issue.

zero-24 avatar May 23 '24 09:05 zero-24

I looks like the core templates work in the right language without the patch.

Without the patch your extension only shows English Only when i move your languagefiles to the /administrator/language/de-DE folder it works for German too. (I have the same issue with a plugin i'm developing right now, so i was hoping this was the solution. :) )

JeroenMoolenschot avatar May 23 '24 09:05 JeroenMoolenschot

Can you see that the german language file is loaded when logged in as german in the language debug?

zero-24 avatar May 23 '24 11:05 zero-24

With the Patch disabled: afbeelding

With the Patch enabled: When i change the backend language to german, all mails switch to german (even en-GB as in this screenshot) afbeelding

JeroenMoolenschot avatar May 23 '24 12:05 JeroenMoolenschot

Ok so the issue i saw is solved now but the switch of language seams not to be respected not by the current nor by the new coding. That needs more debugging than how it should work and why it does not work right now. Thanks 👍

zero-24 avatar May 23 '24 12:05 zero-24

@JeroenMoolenschot I think i have found the issue, please try again.

zero-24 avatar May 23 '24 16:05 zero-24

I have tested this item :white_check_mark: successfully on 423ec9113dc898d0b469ec5a4b388104bd6a12ec

Thank you! This works for me.


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

JeroenMoolenschot avatar May 23 '24 20:05 JeroenMoolenschot

@zero-24 Is this a bug fix or a new feature? If bug fix: Does the bug also apply to 4.4-dev? If so, then it should be fixed there, too (or only there and later be merged up to 5.1-dev). But if new feature: Shouldn't it be made for 5.2-dev?

richard67 avatar Jun 02 '24 12:06 richard67

Moved to 5.2 looking forward to tests on this PR so it can be merged.

zero-24 avatar Jun 02 '24 18:06 zero-24

I have tested this item :white_check_mark: successfully on 53f137eb5cc0857aaa91191985ebb963cfaa8238


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

tecpromotion avatar Jul 16 '24 09:07 tecpromotion

RTC


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

Quy avatar Jul 16 '24 15:07 Quy

Thanks @zero-24 !

pe7er avatar Jul 16 '24 15:07 pe7er

Thanks 👍

zero-24 avatar Jul 16 '24 18:07 zero-24