Skip Navigation

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

Problem:
The client was unable to see the Vietnamese translation in the 'Who We Are' block on their website. Instead of the expected Vietnamese content, English text was displayed.
Solution:
We provided an updated XML configuration for the Gutenberg blocks to ensure proper translation. The client was instructed to replace their existing XML code with the following:

<wpml-config><br />  <gutenberg-blocks><br />    <gutenberg-block type="generateblocks/headline" translate="1"><br />      <key name="gpDynamicTextBefore" /><br />      <key name="gpDynamicUpdatedDateBefore" /><br />      <xpath>//div/strong</xpath><br />      <xpath>//div</xpath><br />      <xpath>//div/h1</xpath><br />      <xpath>//div/h2</xpath><br />      <xpath>//div/p</xpath><br />      <xpath>//h1</xpath><br />      <xpath>//h2</xpath><br />      <xpath>//p</xpath><br />      <xpath>//div/h2/strong</xpath><br />      <xpath>//p/span/a</xpath><br />    </gutenberg-block><br />  </gutenberg-blocks><br /></wpml-config>

We then asked the client to check if the elements were working correctly on two specific pages of their website.

Please note that this solution might be irrelevant if it's outdated or not applicable to your case. If you're experiencing similar issues and the provided solution does not help, we recommend opening a new support ticket. We also highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If further assistance is needed, please contact us through the WPML 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.

Tagged: 

This topic contains 12 replies, has 2 voices.

Last updated by Osama Mersal 1 year, 3 months ago.

Assisted by: Osama Mersal.

Author Posts
April 1, 2024 at 2:28 pm #15469695

robinB-8

I am trying to: translate a page.

Link to a page where the issue can be seen: hidden link

I expected to see: Vietnamese in block "Who We Are"

Instead, I got: English

This is my screen record video to show this error: hidden link

April 1, 2024 at 3:39 pm #15470051

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Thanks for contacting WPML forums support. I'll be glad to help you today.

I would need to look closely at your site, so I would need to request temporary access (WP-Admin and FTP)
Preferably to a test site where the problem has been replicated.

Your answer will be private, meaning only you and I can access it.

❌ Please backup your database and website ❌

✙ I need your permission to deactivate and reactivate the plugins and themes and change site configurations. This is also why the backup is critical.

✙ I also need your permission to take a local copy of your site to debug the issue without affecting your live site.

Best regards,
Osama

April 1, 2024 at 4:59 pm #15470362

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Thanks for the access details. I found the following code in WPML-> Settings-> Custom XML tab.

<wpml-config>
  <gutenberg-blocks>
    <gutenberg-block type="generateblocks/headline" translate="1">
      <key name="gpDynamicTextBefore" />
      <key name="gpDynamicUpdatedDateBefore" />
    </gutenberg-block>
  </gutenberg-blocks>
</wpml-config>

After deleting this code and updating the element in the default language, the strings appeared in the translation editor. (Kindly check the attached screenshot)

Please Translate this element into Vietnamese. (hidden link)

After that, please check the translated home page. (hidden link)

2024-04-01_18-59-21.jpg
April 1, 2024 at 5:19 pm #15470418

robinB-8

Thanks, it fixed.

That is code from my other ticket at here:

https://wpml.org/forums/topic/cant-translate-generateblocks-dynamic-text/#post-15389873

April 1, 2024 at 5:21 pm #15470420

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Please check if removing this code caused an issue with the block from the previous ticket. In order to check that, please create a new test page using this block and translate it.

Best regards,
Osama

April 1, 2024 at 5:24 pm #15470423

robinB-8

I see this xml code have error, so I don't want to check it, I want to remove it

April 1, 2024 at 5:41 pm #15470441

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Okay, if the issue is fixed, you can remove it.

Best regards,
Osama

April 1, 2024 at 5:44 pm #15470447

robinB-8

this ticket fixed, but my other ticket still have issue: https://wpml.org/forums/topic/cant-translate-generateblocks-dynamic-text/#post-15389873

April 1, 2024 at 6:02 pm #15470475

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

I updated the XML code to be the following:

<wpml-config>
  <gutenberg-blocks>
    <gutenberg-block type="generateblocks/headline" translate="1">
      <key name="gpDynamicTextBefore" />
      <key name="gpDynamicUpdatedDateBefore" />
      <xpath>//div/strong</xpath>
      <xpath>//div</xpath>
      <xpath>//div/h1</xpath>
      <xpath>//div/h2</xpath>
      <xpath>//div/p</xpath>
      <xpath>//h1</xpath>
      <xpath>//h2</xpath>
      <xpath>//p</xpath>
      <xpath>//div/h2/strong</xpath>
      <xpath>//p/span/a</xpath>
    </gutenberg-block>
  </gutenberg-blocks>
</wpml-config>

Please check if the following elements work correctly:

1) hidden link

2) hidden link

Best regards,
Osama

April 2, 2024 at 7:35 am #15471183

robinB-8

but with this code:

<xpath>//div/strong</xpath>
<xpath>//div</xpath>
<xpath>//div/h1</xpath>
<xpath>//div/h2</xpath>
<xpath>//div/p</xpath>
<xpath>//h1</xpath>
<xpath>//h2</xpath>
<xpath>//p</xpath>
<xpath>//div/h2/strong</xpath>
<xpath>//p/span/a</xpath>

if my site change design, is this code still work?

April 2, 2024 at 1:10 pm #15473017

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

This code covers most of the possible tags. However, if you need to add a new tag or change the site's design, you can easily do so.

Please check our guide about registering blocks. (https://wpml.org/documentation/support/language-configuration-files/make-custom-gutenberg-blocks-translatable/)

Best regards,
Osama

April 2, 2024 at 1:41 pm #15473185

robinB-8

if my site have h3, h4, h5, h6. Does this code cover them?

<xpath>//div/strong</xpath>
<xpath>//div</xpath>
<xpath>//div/h1</xpath>
<xpath>//div/h2</xpath>
<xpath>//div/p</xpath>
<xpath>//h1</xpath>
<xpath>//h2</xpath>
<xpath>//p</xpath>
<xpath>//div/h2/strong</xpath>
<xpath>//p/span/a</xpath>

April 2, 2024 at 1:44 pm #15473208

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

If the (h3, h4, h5, h6) are in the same "generateblocks/headline" block, please add them to the code.

<xpath>//div/h3</xpath>
<xpath>//div/h4</xpath>
<xpath>//div/h5</xpath>
<xpath>//div/h6</xpath>
<xpath>//h3</xpath>
<xpath>//h4</xpath>
<xpath>//h5</xpath>
<xpath>//h6</xpath>

Best regards,
Osama

April 3, 2024 at 1:35 am #15475644

robinB-8

thanks