Add translationMode option to MLRepeater & MLNestedForm formwidgets - #76
Add translationMode option to MLRepeater & MLNestedForm formwidgets#76mjauvin wants to merge 54 commits into
translationMode option to MLRepeater & MLNestedForm formwidgets#76Conversation
translateFields option to MLRepeater formwidget. translationMode option to MLRepeater formwidget.
|
@kubamarkiewicz have you been testing this PR ? |
|
@mjauvin thanks for adding translatable property, I will test it tomorrow |
|
@mjauvin I have tested nestedform with the translatable property in yaml file and it is working correctly! Thanks for adding it.
|
|
@mjauvin I have done some more tests and have found a bug. When nested form/repeater definition is not placed in fields.yaml file but instead is located in a separate file and linked to the fields.yaml file like this: then the following error appears:
|
|
@kubamarkiewicz can you try the fix I just commited ? Thanks for your help, much appreciated! |
|
@mjauvin now it works! Thanks for the fix. |
|
@mjauvin here it a css fix for the bug with "fancy-layout", that I have commented earlier: |
I added your css fix to this PR. Thanks. |
|
I tried this PR with the stable version of wn-pages-plugin and saving a static page doesn't work at all because it cannot properly identify the static page title. The title field's translate input name ends up being |
|
Static pages plugin sets its fields without arrayNames. The title formField's name is I'm also realising this is probably normal since this is a BC and other plugins will need to update for this. |
Thanks for reporting this. I'll need to investigate further, but it might be required for me to cope for the case where the arrayName is not set. Otherwise, we're going to have to make a change to the pages plugin, but it should be doable in this PR. If you want to experiement with a fix in this PR, please do so as I don't have much time to look into this at the moment. |
|
Just did PR #83 to fix the issue I mentionned, feel free to review. |
Replace the global autoTranslateWhiteList config with a per-field opt-in: a composite widget's nested sub-field is machine-translated on copy only when its field definition declares translatable: true; everything else is copied verbatim. This fixes the global whitelist's structural problems (one list bleeding across every model/widget, and collisions between same-named fields) by declaring translatability where it belongs — at the field. It also aligns with the translatable: true convention from #76 / issue #21, so translatability is expressed once and consistently. getAutoTranslatableFields() now collects translatable field names by walking the widget's field definitions: group mode (repeater groups / blocks) and single form mode (repeater / nestedform), descending into nested forms and stripping @context suffixes. The autoTranslateWhiteList config key is removed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>


This allows translating internal fields of Repeater/NestedForm FormWidgets.
See `Repeater/NestedForm formwidget internal fields translation section in README.md for more details.
Fix #21
In order to test this, you can clone this branch with the following git command: