User tests: Successful: Unsuccessful:
Pull Request resolves # .
When editing a module and selecting an alternative layout provided by a site template (override), the layout dropdown renders labels in en-GB instead of the admin's current language. If no translation exists, of course the filename would be displayed.
There is a bug in ModuleLayoutField::getInput() where it loads the language with with the $default = true parameter, which triggers Language::load()'s implicit en-GB preload. When an earlier field on the same form has already loaded the same language file e.g. the Position field, the current-language filename is cached. The preload merges en-GB on top of the existing current-language strings, That way, a translation provided by a the template, would not be used.
Debug Language set to "On" masks the bug because it skips the preload.
A practical / real life scenario would be, if you created a custom site template and ship that with an override for, let's say: mod_articles. This override introduces a new layout called: fancy-with-sugar-on-top.php
The corresponding language string for that layout would then be:
TPL_YOURTEMPLATE_MOD_ARTICLES_LAYOUT_FANCY-WITH-SUGAR-ON-TOP="Fancy article layout with sugar on top"
Download and install the demo template tpl_acme.zip. It has got a custom layout for mod_articles called: translateme.php. The template / style does not have to be activated.
I've included language files for en, es and de to test this with. Now, set the backend language either to Spanish or German, given you installed one of these first.
Create a new module instance of mod_articles and switch over to the Advanced Tab -> Layout. The dropdown should list all available overrides / layouts grouped by template + the default option.
Regardless of the selected backend language, the en-GB version of the translation is used.
The drowdown shows the translation currently selected as the default.
Please select:
Documentation link for guide.joomla.org: n/a
No documentation changes for guide.joomla.org needed
Pull Request link for manual.joomla.org: n/a
No documentation changes for manual.joomla.org needed
| Status | New | ⇒ | Pending |
| Category | ⇒ | Libraries |
| Labels |
Added:
PR-6.1-dev
|
||
| Status | Pending | ⇒ | Closed |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2026-04-22 21:23:40 |
| Closed_By | ⇒ | iteidrm |
@joomdonation thank you for your feedback and pointing out a better solution.
The bug does exist in Joomla! 5.4.5, too. I can confirm that your proposed solution fixes the problem.
I will close this PR and create a new one against that branch.
I think the way we are loading template language files here are OK and consistent with everywhere in Joomla. The real reason of this issue comes from different place https://github.com/joomla/joomla-cms/blob/6.1-dev/administrator/components/com_modules/src/Helper/ModulesHelper.php#L251-L254
If we change the code in ModulesHelper above to load template language files in the same way with how we do in ModuleLayoutField, the issue will be fixed.
Also, could you check to see if this bug also happens on 5.4? If it is, then the PR should be made to 5.4-dev branch