Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

take RichTextBehavior fields into account when using google translate #465

Merged
merged 11 commits into from
Oct 7, 2024

Conversation

erral
Copy link
Member

@erral erral commented Sep 29, 2024

Fixes #464

The old code had references to archetypes fields, not needed any more, and ignored current RichText fields.

This implementation works only with fields coming from the RichTextBehavior. It can't work with standard schema based RichText fields, because they have no marker in the HTML to signal that they are rich text fields.

@mister-roboto
Copy link

@erral 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!

@erral
Copy link
Member Author

erral commented Sep 29, 2024

@jenkins-plone-org please run jobs

@erral erral requested review from 1letter and petschki October 3, 2024 08:02
@erral
Copy link
Member Author

erral commented Oct 3, 2024

I don't know if you can help me here @1letter and @petschki

I need some review on this to have the confirmation that this is right.

The point is that we have some JS code to get the value of a field and send it through a browser view to a translation service (this is already implemented in p.a.multilingual yay!), but it does not work with the current richtext fields although I do these changes.

@petschki
Copy link
Member

petschki commented Oct 3, 2024

I'll take a look today. I saw some issues notably that my translation page is getting longer and longer every second 😉 ... I'll come up with some improvements.

@erral
Copy link
Member Author

erral commented Oct 3, 2024

I'll take a look today. I saw some issues notably that my translation page is getting longer and longer every second 😉 ... I'll come up with some improvements.

Use the latest code in master, we merged some changes to get the context correctly some days ago.

And if you have time, check also #468 :)

@petschki petschki force-pushed the erral-modernize-gtranslate branch from 07143a5 to 1bdb7ab Compare October 3, 2024 14:28
@petschki
Copy link
Member

petschki commented Oct 3, 2024

I've rewritten the babel helper in order to meet the current classic-ui standards. (still some $.ajax calls in there, but thats ok) ... the vertical repositioning is now "just" setting the heights of the fields equally instead of calculating each height/padding individually. I think it looks much better this way. Also there's some code cleanup for the visibilities and I use the pat-autotoc "clicked" event to trigger the visible fields on the page ...

unfortunately setting the content of tinymce to the translated text is a bit flaky ... need to check whats the problem there. Sometimes I see updated word count but no content 🤔

NOTE: this also works with every .richTextWidget in the schema in theory ... not only IRichTextBehavior

@petschki
Copy link
Member

petschki commented Oct 4, 2024

@jenkins-plone-org please run jobs

@petschki
Copy link
Member

petschki commented Oct 7, 2024

@jenkins-plone-org please run jobs

@erral erral merged commit 53dda3d into master Oct 7, 2024
12 checks passed
@erral erral deleted the erral-modernize-gtranslate branch October 7, 2024 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RichText field contents are ignored when trying to use Google Translate service
3 participants