-
Notifications
You must be signed in to change notification settings - Fork 22
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
[FEATURE]: Translate Rich Text Blocks #401
Comments
Any updates? |
Hi @jsadoski-rockhall and @boardmain, Thank you for your interest in this plugin and the feature proposal! This is definitely an important feature that should be implemented in this plugin. However currently, we as maintainers have more pressing issues on the internal side and are also working voluntarily. If you require this feature, we would be very happy if you would try to implement it yourself and create a pull request. We will give you feedback on problems you may encounter. From my understanding, the easiest way to implement this feature would be to create a rendering from the blocks syntax to html or xml, then translate that on the provider, and then convert it back to the blocks syntax. An issue that may definitely arise is that the rendering to html is (at least in the referenced html renderer) a lossy conversion, as not all properties are used in the html. I am not quite sure how this can be handled yet. Another problem may arise when the document is too large to be translated in one request. Currently, there is also no good handling for splitting html documents, but this problem should definitely considered. |
@sargreal Thank you for the update. Sending HTML to Deepl certainly seems like a good idea, even given the limitations. I won't have any time to work on this anytime soon, but if it's still open in a couple of weeks, I may take a look. Thank you Strapi team for all you do, especially the volunteers! |
@sargreal but if i try to add for example to the strapi-plugin-translate configurator inside plugins.js translatedFieldTypes: [ it is ignored by the plugin and i can't Handle this type in the custom provider in the "getFieldTypeConfig(type) function"
i see:
is like the translatedFieldTypes in the config is ignored, but the default is taken can you help to modify the response of strapi.config.get('plugin.translate') ? if it isn't handled by the plugins.js config gile i'm trying to handle it exactly like markdown, ( jsonb-> html -> translate -> html -> jsonb ) |
@boardmain I think that was the idea behind @sargreal's suggestion. Deepl can handle HTML input, so the content would need to be translated to HTML first and then sent to Deepl. Of course, then, I guess it would need to be translated back into Blocks in order to be saved. I'm sure that would introduce all manner of edge cases. This feature may be stretching the limits of automated translation while preserving formatting. Markdown may be the ultimate solution, since Deepl handles it natively. |
translatedFieldTypes: [
'string',
{ type: 'blocks', format: 'jsonb' },
{ type: 'text', format: 'plain' },
{ type: 'richtext', format: 'markdown' },
'component',
'dynamiczone',
], So first of all, there seems to be something wrong with your setup, since I get an expected Error I believe the format parsing should completely be implemented on the plugin side, as the providers should only provide the translation function. The execution of the format conversion is only done on the provider side, since we cannot be sure which formats are supported by a provider (although that could also be stated in the provider's declaration as well. That would be a breaking change however). Anyways, I have tried today a little bit at implementing this feature in a rudimentary state and will open a PR in the next days where you can have a look and maybe build from there. |
@sargreal yes i had an error in my plugins.js config file, now i have correctly the "Error regarding translate config" the only question, if i can't add jsonb ( { type: 'blocks', format: 'jsonb' }, ) to the plugin config, how i can handle this new field in my plugin? i can't handle like markdown ( in the deepl provider )
|
This implements basic support for the blocks format for the blocks rich text editor fix #401
thank you, { type: 'richtext', format: 'markdown' }, so i can handle it in a custom provider? |
until this update will be fixed, if anyone need it simply install it with "npm instlal strapi-provider-translate-deepljsonb" and replace deepl with deepljsonb i the plugin.js config it is not perfect, but for now is working Ah you need define blocks as markdown in the plugin translate config ( view the readme of the module in npm ) |
Hello. I have tried your solution, but nothing changes :( |
This implements basic support for the blocks format for the blocks rich text editor fix #401
This implements basic support for the blocks format for the blocks rich text editor fix #401
This implements basic support for the blocks format for the blocks rich text editor fix #401
Is your feature request related to a problem? Please describe.
When using the new Rich Text (Blocks) field, the content is not translated.
Describe the solution you'd like
Rich Text (Blocks) fields should be translated to the target locale.
Describe alternatives you've considered
For now, this field type is unusable if automated translation is required. Instead, we must continue to use Rich Text (Markdown) text fields.
Additional context
We use Deepl to translate our content. Given the structure of Blocks objects in the Strapi API, it may be difficult to send to the translation API and get back a meaningful response that respects grammar, etc.
Sorry if this issue has already been raised, but I didn't find any previous GH issues.
The text was updated successfully, but these errors were encountered: