Skip to content

Build the localized tab names only when the tabs are read - #211

Open
boo-code wants to merge 1 commit into
PrestaShop:devfrom
boo-code:fix/tab-names-only-when-tabs-are-read-210
Open

boo-code wants to merge 1 commit into
PrestaShop:devfrom
boo-code:fix/tab-names-only-when-tabs-are-read-210

Conversation

@boo-code

@boo-code boo-code commented Nov 2, 2026

Copy link
Copy Markdown
Questions Answers
Description? The constructor translated the tab name into every active language (trans(..., $lang['locale']) in a loop), and each of those calls loads that language's whole translation catalogue. The constructor runs every time the module is instantiated, including for every Module Manager listing, so a shop with many languages loads all their catalogues on those requests (the issue measures +38 MB with 22 languages and an out-of-memory error at 512 MB).

The constructor now declares the tab with a plain name, and getTabs() builds the localized names. The core reads module tabs only through getTabs() (ModuleTabRegister on install, and after module actions), so the tab names stay localized as before. A plain string alone would install the English name in every language: ModuleTabRegister::getTabNames() copies a string to all languages, it does not translate wording at install.
Type? bug fix
BC breaks? no
Deprecations? no
Fixed ticket? Fixes #210
How to test? On a shop with 2 languages (en-US, fr-FR), counting the translator's loaded catalogues around new Ps_Linklist(): before, en-US then en-US, fr-FR; after, en-US then en-US. getTabs() returns the same per-locale names in both cases ({"en-US":"Link List","fr-FR":"Link List"} here, no French translation of that string installed).

The constructor translated the tab name into every active language, which loads the whole translation catalogue of each language every time the module is instantiated (the Module Manager instantiates every module). getTabs() now builds those names, so they are still localized on install and reload.
@ps-jarvis

Copy link
Copy Markdown

Hello @boo-code!

This is your first pull request on ps_linklist repository of the PrestaShop project.

Thank you, and welcome to this Open Source community!

@github-project-automation github-project-automation Bot moved this to Ready for review in PR Dashboard Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for review

Development

Successfully merging this pull request may close these issues.

ps_linklist constructor loads the translation catalogue of every active language – Module Manager runs out of memory on multi-language shops

2 participants