This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 1 reply, has 2 voices.

Last updated by Rohan Sadanandan 2 months, 2 weeks ago.

Assigned support staff: Rohan Sadanandan.

Author Posts
July 31, 2019 at 4:31 pm

gunnarK-4

(Reposting this here, as my original question was posted to the German support forum, but I typed it in English. OP: https://wpml.org/de/forums/topic/acf-wpml-independent-translation-of-repeater-and-flexible-content-fields/#post-4315201)

I have just taken over development of a web site using WPML in conjunction with a complex ACF setup. The setup includes flexible content layouts, repeaters and clones thereof.

The goal is to make translated pages completely independent from their original language versions: flexible content layout elements should ideally be copied once from the original page when the translated page is created, but after that it should be possible to add, edit and delete layout elements independently for each language version of a page.

I do not intend to translate the backend, so post type 'acf-field-group' is set to 'Not translatable' in WPML settings' 'Post Types Translations'.

The ACF setup looks roughly like this:

Page (field group)
- Sections (repeater)
-- Main Column (clone of flexible content in a different field group)
--- numerous flexible content layouts with a wide range of field types
-- Side Column (clone of flexible content in a different field group)
--- numerous flexible content layouts with a wide range of field types

What I have tried:

- Setting all relevant ACF fields to 'Copy once', except tabs, messages, columns* which I i set to 'Don't translate'. (*I'm using the plugin 'ACF Columns')

Result: None of the cloned fields are copied on creating the initial translation. The 'Copy content' button does nothing. On editing and saving the translation (adding and editing new flexible layout fields), the flexible content layout is copied from the original language version (without content if the fields that did not exist in the initial translation). Content in those newly copied fields can be edited and saved, but fields cannot be added or deleted - the layout of the flexible content stays synchronized to the original language version and cannot be changed.

- Setting all relevant ACF fields to 'Translate' (except tabs, messages, columns, see above)

Result: Same faulty behaviour as with 'Copy once'. In addition I get this warning after creating the initial translation: "WPML will copy _wpml_media_duplicate, _wpml_media_featured, sections_0_blocklist, sections_0_side_style, sections_0_side_background from German, when you save this post."
This is odd, as the mentioned fields - blocklist, side_style - are most definitely set to 'Translate', not 'Copy' in their field groups.

To further inspect this I did the following:

- Install 'WPML Translation Management' plugin to inspect all custom fields in one table (under WPML > Settings > Custom Fields Translation).

Result: I was shocked to discover over 1.700 custom fields in this table (see attached image), all indexed by nested repeater and flexible content fields (e.g 'sections_3_blocklist_2_items_0_content', up to 'sections_5...')! These fields have translation setting values assigned to them that don't reflect the corresponding settings in their field groups, e.g. 'Copy' or 'Don't translate'.

Questions:

- Why are field entries replicated in this way?
- Are they generated when saving a post? If yes, based on which translation settings - current field group values?
- Why don't their respective translation settings reflect the current values in their corresponding field group?

Solution (somewhat):

- Next I changed some of the assumingly relevant values here to 'Copy once' (such as the 'sections_0_blocklist' mentioned in the warning)

Result: This seemed to do the trick of making the layouts independent (editing, saving, deleting elements)! However, content and layouts are still not copied over on creation of a translation.

More questions:

- If this is the solution, how can I 'bulk edit' the field entries in the 'Custom Fields Translations' list - I don't want to edit >1.700 entries manually. Changing the original fields in the field groups doesn't seem to affect the iterations here!
- Is there any relevance to the system fields in this context? (Every field seems to have an underscore-prefixed equivalent set to 'Don't translate'.)
- What are recommended translation settings for flexible content and repeater fields to produce the intended behaviour (copy layouts and content once, edit, add, delete independently after that)
- What are recommended translation settings for clones, tabs, messages, and columns if backend and field groups are not translated? (Or do they simply not matter?)

Any assistance in producing the intended behaviour is welcome. Staging site and FTP access can be provided. The backend is unfortunately kept in German, but I can provide assistance via text or voice chat.

August 1, 2019 at 9:17 am #4320101

Rohan Sadanandan
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello,

Thank you for contacting WPML Support.

As I can see that you have already reported this issue here: https://wpml.org/de/forums/topic/acf-wpml-independent-translation-of-repeater-and-flexible-content-fields/#post-4315201

Our teammate is handling this ticket in the other thread and he will update you soon.
For better support, we handle one issue per ticket. So I am closing this ticket.

If you need any help, please let us know.

Thanks,
Rohan