Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client was unable to translate certain fields from ACF blocks in the Advanced Translation Editor, such as link text and URLs. Additionally, most ACF blocks were not appearing in the Custom Fields Translation settings.

Solution:
1) We recommended increasing the WP Memory limit to 256M by adding the following code to the wp-config.php file:

define('WP_MEMORY_LIMIT', '256M');

2) We advised ensuring that "ACF Field Groups" are set to "Not translate" in WPML > Settings > Post Type Translation.
3) We suggested verifying that the ACF Field Group uses the translation preference setting "Same fields across languages".
Guide
4) We instructed the client to edit the fields on the original content and then open the WPML Translation Editor again.
5) We identified that field groups with the same field names were causing issues and recommended making each field name unique.
Source
6) We changed the translation preference for the Link field to "translate" and explained that external links usually need to be searched using the text search input in ATE.
Default setting for Links
7) We provided instructions on creating a custom XML config and placing it in the root folder of the theme or plugin responsible for the block, or adding it at WPML > Settings > Custom XML Config.
Guide
8) We provided an example of a custom XML config for translating a button's text and link:

<wpml-config>
  <gutenberg-blocks>
    <gutenberg-block type="wp-bootstrap-blocks/button" translate="1">
      <xpath>//div/a</xpath>
      <key name="text"></key>
      <xpath type="link">//div/a/@href</xpath>
      <key name="url"></key>
    </gutenberg-block>
  </gutenberg-blocks>
</wpml-config>

If the solution provided here is not relevant to your case, either because it's outdated or not applicable, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please open a new support ticket at our support forum.

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 20 replies, has 3 voices.

Last updated by peterR-59 7 months, 1 week ago.

Assisted by: Andreas W..

Author Posts
April 19, 2024 at 2:36 am #15541582

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

It appears that our default setting for Links in this case is "copy":
https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/recommended-custom-fields-translation-preferences-for-acf-and-wpml/

The reason for this default is that most links are internal links and do not need a translation.

Take note, with WPML internal links are generally not supposed to show up inside ATE, as they will be adjusted automatically once the internal content has been translated.

I switched the group to Expert mode and set the Link field to "translate" now.

External links usually will need to be searched using the text search input on the top left of ATE. In this specific case, it would not be necessary to search for external links, as the Link field's translation preference "translate" will display external links by default on ATE.

April 19, 2024 at 3:31 am #15541627

peterR-59

Thanks for your help so far Andreas – setting the ACF field group to 'Expert' mode and its fields to 'translate' seems to work well.

My only other question is how would I apply these same settings to the Bootstrap Button block fields – this is not an ACF block but rather a custom block generated by the Bootstrap Blocks plugin https://wordpress.org/plugins/wp-bootstrap-blocks/ ?

Screenshot 2024-04-19 at 1.27.32 pm.png
April 19, 2024 at 2:55 pm #15544435

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

You would need to create a custom XML config, save it inside a wpml-config.xml file, and place the file inside the root folder of the theme or plugin responsible for the block.

You also can add such configs at WPML > Settings > Custom XML Config.

Guide:
https://wpml.org/documentation/support/language-configuration-files/make-custom-gutenberg-blocks-translatable/

As you can see, you can use an XPath to get the button, like in this case:

For the button text, you would use:

//div/a

For the link:

//div/a/@href

Important to know is, which name the block has in your code, which would be the type attribute in the gutenberg-block tag.

Example:

<gutenberg-block type="my-plugin/my-block" translate="1">
April 20, 2024 at 1:37 am #15545365

peterR-59

Thanks for steering me in the right direction Andreas, I've tried adding the following to the Custom XML Config in Settings and also in a wpml-config.xml file in the theme folder:

<wpml-config>
<gutenberg-blocks>
<gutenberg-block type="wp-bootstrap-blocks/button" translate="1">
<xpath>//div/a</xpath>
<xpath>//div/a/@href</xpath>
</gutenberg-block>
</gutenberg-blocks>
</wpml-config>

This seems correct to me but I'm still unable to translate the button – any ideas?

April 20, 2024 at 2:57 am #15545384

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

I took a look at your code. In this case, we additionally need to call the attributes with a key:

<wpml-config>
  <gutenberg-blocks>
    <gutenberg-block type="wp-bootstrap-blocks/button" translate="1">
      <xpath>//div/a</xpath>
      <key name="text" />
      <xpath type="link">//div/a/@href</xpath>
      <key name="url" />
    </gutenberg-block>
  </gutenberg-blocks>
</wpml-config>

Let me know if you have any questions.

April 23, 2024 at 1:01 am #15553311

peterR-59

That did the trick, thanks again for your help Andreas.

Cheers,
Peter