plone / plone.app.multilingual

Plone Multilingual Content Add-on
https://pypi.org/project/plone.app.multilingual
18 stars 47 forks source link

"Manage Translations" view should not call translation objects #384

Closed mliebischer closed 2 years ago

mliebischer commented 3 years ago

Issue: The @@modify_translations view (e.g. https://demo.plone.org/de/frontpage/@@modify_translations) may be slow, especially if the page rendering of a single page is slow and you have a lot of translations. The problem will get worse with each translation. For one of our customers this means that the view loads for more than 30 seconds.

Versions: Plone 5.2.2 plone.app.multilingual 5.6.3

Code analysis: The modify_translations.pt collects all translations of a specific object, see: https://github.com/plone/plone.app.multilingual/blob/3c3c58731dda1db8588cf36108f9277dc83cfe1d/src/plone/app/multilingual/browser/templates/modify_translations.pt#L28-L29

Later on some tal-expressions will be made on these objects. But some of them trigger an implicit object call (in other words the page content will be rendered, but never shown to the user), see:

https://github.com/plone/plone.app.multilingual/blob/3c3c58731dda1db8588cf36108f9277dc83cfe1d/src/plone/app/multilingual/browser/templates/modify_translations.pt#L35

Possible fix: Be explicit and avoid calling the objects, like

<tal:hastranslation condition="python:translation">