Skip to content

Conversation

sargreal
Copy link
Member

@sargreal sargreal commented Mar 1, 2024

This adds experimental support for translating the blocks editor (fixes #401). The current implementation is very rudimentary.

Things to consider before merging:

  • How to handle images better? The current way of creating a cache does not delete any images and may become a memory leak in large applications. But it is not clear when the cache may be deleted
  • How to handle code better? In the current state, DeepL may just translate the code and in the process also remove any line breaks.
  • Is it worth launching this feature in an experimental state, since we currently do not have the resources to fix bugs?

@sargreal sargreal requested a review from layaxx March 1, 2024 22:12
@sargreal sargreal linked an issue Mar 1, 2024 that may be closed by this pull request
Copy link

codecov bot commented Mar 1, 2024

Codecov Report

Attention: Patch coverage is 65.47619% with 29 lines in your changes are missing coverage. Please review.

Project coverage is 47.77%. Comparing base (0823a66) to head (3cb37ca).

Files Patch % Lines
plugin/server/services/format.js 68.57% 9 Missing and 13 partials ⚠️
providers/deepl/lib/index.js 50.00% 2 Missing and 2 partials ⚠️
providers/libretranslate/lib/index.js 50.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #402      +/-   ##
==========================================
+ Coverage   45.95%   47.77%   +1.81%     
==========================================
  Files          47       47              
  Lines         866      942      +76     
  Branches      187      211      +24     
==========================================
+ Hits          398      450      +52     
- Misses        310      322      +12     
- Partials      158      170      +12     
Flag Coverage Δ
unittests 47.77% <65.47%> (+1.81%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@layaxx layaxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should merge this into main right now. At most as an opt-in via a next release or something like that.
I agree that the handling of code (both blocks and inline) is not great, not sure what to do here. Same with the clearing of the img cache

@bieblebrox
Copy link

Is there any progress on this? Would be a very useful feature to have.

@sargreal sargreal force-pushed the 401-feature-translate-rich-text-blocks branch from 3cb37ca to def1f32 Compare August 22, 2024 12:30
@sargreal sargreal changed the base branch from main to next August 23, 2024 06:38
@sargreal
Copy link
Member Author

I don't think we should merge this into main right now. At most as an opt-in via a next release or something like that. I agree that the handling of code (both blocks and inline) is not great, not sure what to do here. Same with the clearing of the img cache

I actually realised that code is currently handled the same with markdown and other html stuff. I believe that this should be made into a separate "known" bug for now.

@sargreal sargreal self-assigned this Aug 23, 2024
@sargreal sargreal modified the milestones: v2.0, v1.3 Aug 23, 2024
@sargreal sargreal force-pushed the 401-feature-translate-rich-text-blocks branch from 8bcc8be to 083804e Compare October 2, 2024 13:44
@sargreal sargreal force-pushed the 401-feature-translate-rich-text-blocks branch from 083804e to 69bf97b Compare December 17, 2024 21:28
@layaxx layaxx self-requested a review February 1, 2025 16:53
Copy link
Member

@layaxx layaxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sargreal sargreal merged commit 48b179c into next Feb 1, 2025
11 checks passed
@fekide-bot
Copy link

🎉 This PR is included in version 1.3.0-next.3 🎉

The release is available on npm package (@next dist-tag)

Your semantic-release bot 📦🚀

@fekide-bot
Copy link

🎉 This PR is included in version 1.2.0-next.1 🎉

The release is available on npm package (@next dist-tag)

Your semantic-release bot 📦🚀

@fekide-bot
Copy link

🎉 This PR is included in version 1.1.0-next.1 🎉

The release is available on npm package (@next dist-tag)

Your semantic-release bot 📦🚀

@fekide-bot
Copy link

🎉 This PR is included in version 1.3.0 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@fekide-bot
Copy link

🎉 This PR is included in version 1.2.0 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@fekide-bot
Copy link

🎉 This PR is included in version 1.1.0 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@bieblebrox
Copy link

Confirmed working using: 1.3.2

Please note that you also need to upgrade your translation provider (in my case strapi-provider-translate-deepl ) to get it working.

Thanks a lot guys this will save us a ton of time managing content!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Translate Rich Text Blocks

4 participants