- Issue created by @arwillame
When using ai_translate it can end up with infinite loop when trying to translate a content with entity reference that reference content.
- Create a node that has a field that reference this same node.
- In ai_translate configuration : /admin/config/ai/ai_translate check "content" under the "Entity reference translation" config.
- Translate this node using the "Translate using AI" link.
- It will generate an infinite loop.
The infinite loop is due to the fact that in the file web/modules/contrib/ai/modules/ai_translate/src/Plugin/FieldTextExtractor/ReferenceFieldExtractor.php
, the extract() method will dive recursively in all referenced entity of the node, meaning that if the node reference itself, or if at some point in the recursive, we come back to the original node, it will create an infinite loop.
Multiple ideas :
- Limit the recursive to only translate the content referenced in the original node. (depth : 1)
- Limite the recursive to a max depth set in config
- Put the already translated entities in an array to make sure we only try to translate it once ( not big fan of this one, we could translate the entire website without knowing it if there is a lot of reference in the nodes).
Active
1.0
Other Submodules