plone / plone.app.multilingual

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

Backport fix to disconnect translation for 7.x #450

Closed krissik closed 7 months ago

krissik commented 8 months ago

See #449

mister-roboto commented 8 months ago

@krissik thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

krissik commented 8 months ago

If I run zprettier locally I see that it will add the additional ';' again (which caused the bug)

diff --git a/src/plone/app/multilingual/browser/templates/modify_translations.pt b/src/plone/app/multilingual/browser/templates/modify_translations.pt
index eb6576b..0769e38 100644
--- a/src/plone/app/multilingual/browser/templates/modify_translations.pt
+++ b/src/plone/app/multilingual/browser/templates/modify_translations.pt
@@ -74,7 +74,7 @@
                      href="#"
                      title="Disconnect translation"
                      tal:attributes="
-                       href python:context.absolute_url() + '/disconnect_translation?came_from=' + context.UID() + '&language=' + lang;
+                       href python:context.absolute_url() + '/disconnect_translation?came_from=' + context.UID() + '&language=' + lang;;
                      "
                      i18n:attributes="title disconnect_translation"
                   >

How can I exclude modify_translations.pt? I have tried

[pre_commit]
zpretty_extra_lines = """
        extend-exclude: "modify_translations\.pt"
"""

at .meta.toml and run plone-meta again. But it is not working.

davisagli commented 8 months ago

@krissik Try getting rid of both semicolons. I don't think a semicolon is needed when there is only one attribute, and it may be that zpretty is not handling that case correctly.

krissik commented 8 months ago

@jenkins-plone-org please run jobs

krissik commented 8 months ago

@krissik Try getting rid of both semicolons. I don't think a semicolon is needed when there is only one attribute, and it may be that zpretty is not handling that case correctly.

There is an issue with zpretty https://github.com/collective/zpretty/issues/130 I have encoded & - now zpretty is happy.