Skip Navigation

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

Problem:
The client needed to resolve an issue with translating links within Lazyblocks using WPML.

Solution:
We recommend following these steps:
1. Add the following XML in WPML -> Settings -> Custom XML Configuration:

<wpml-config>
  <gutenberg-blocks>
    <gutenberg-block type="lazyblock/ns-announcement" translate="1">
      <key type="link" name="button-link" />
    </gutenberg-block>
  </gutenberg-blocks>
</wpml-config>

2. Create a new page and add the lazyblock with the necessary information, including the link.
3. Save and translate the page to the desired language.
4. In the Advanced Translation Editor (ATE), the URL should automatically set to the translated version.
5. Translate the remaining content and complete the translation.
6. The link should now point to the translated version of the page in the new language.

However, if you encounter a limitation where the URL inside the block attribute does not adjust automatically, you will need to translate the links manually in the Advanced Translation Editor.

Please note that this solution might be irrelevant if it's outdated or not applicable to your case. If the issue persists, we 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 needed, please open a new support ticket with us.

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 8 replies, has 2 voices.

Last updated by Waqas Bin Hasan 10 months, 3 weeks ago.

Assisted by: Waqas Bin Hasan.

Author Posts
January 25, 2024 at 8:10 am #15224727

bjarteL

Hello, a while back we started to debug a issue with WPML and Lazyblocks translation issues with links.

We had a topic on this, that was closed due to inactivity, i would like to re open this topic: https://wpml.org/forums/topic/reopen-topic-translate-link-targets-for-pages/

January 25, 2024 at 8:32 am #15224829

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Reference to our recent chat and the last message from your previous ticket, try to replicate the issue on a clean installation of WordPress. With this link, you can login to the admin area directly hidden link

Kindly follow the steps below:

- Don’t restore your site there.
- Install LazyBlocks plugin.
- Try to replicate the issue with minimal steps.
- Then let me know the steps to replicate it.

Regards.

January 25, 2024 at 1:48 pm #15226558

bjarteL

Hi,

I have set up a small test where it behaves as it does on our site. I made a "Test Page" and a "Subpage" in the English language. The "Subpage" is just empty with nothing in it, it is just there to provide an internal link.

I added a Lazy Block where there is a button with a link that is fetched from Lazy Blocks content controls, URL control.

The block is in the content of the "Test Page" and points to the "Subpage". Now the link itself shows up in ATE which is good but since our live page has over 13 languages and a lot of pages, then it should be able to adjust the links automatically using "Translate Link Targets" feature under WPML settings page. If i click the "Scan now and adjust links" it says 0 links were changed to point to the translated content, although a translated version of both pages exist.

If you could take a look and see if something can be done for this.

Regards.

January 26, 2024 at 7:24 am #15228793

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the updates. I am working on this and 'll get back to you as soon as I find something or have a solution.

January 26, 2024 at 11:19 am #15229785

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation.

I tried several things and ultimately found that the solution provided by my colleague earlier (https://wpml.org/forums/topic/reopen-topic-translate-link-targets-for-pages/#post-14935531) is the correct one.

To summarize this, I followed these steps:

- Added following XML in WPML -> Settings -> Custom XML Configuration:

<wpml-config>
  <gutenberg-blocks>
    <gutenberg-block type="lazyblock/ns-announcement" translate="1">
      <key type="link" name="button-link" />
    </gutenberg-block>
  </gutenberg-blocks>
</wpml-config>

- Created a new page (hidden link).

- Added that lazyblock and filled with the information, including the link to another page I created earlier (and translated to other languages, like your sub page) hidden link

- Saved
- Translated the page to German.
- In ATE, I could see the URL set to the translated version already (see attached).
- I simply translated other content and completed the translation.
- Now on the German version of the page, I can see the link pointing to the German version of the other page (hidden link).

Please follow these steps and issue should be resolved.

January 26, 2024 at 1:13 pm #15230304

bjarteL

Hi,

Thanks for the quick reply, i have been able to replicate this but also have gotten 3 different outcomes so far.

1. Created a new page but the link is not automatically adjusted in ATE image (test1).
2. The URL does not even appear in the ATE image (test2).
3. It automatically suggested the link in ATE as for you as well image (test3).

We might have a case where all of the content is not translated and published at the same time, for example we add a page and translate it only in 5 languages but the other ones come later, until then they for example direct all to English but would like that later when the translations for the pages are added, the links are automatically adjusted, using the adjust links functionality in WPML settings, is this possible and should it even work like this?

Most commonly currently im getting the outcome where the url is there but in wrong language still.

For example i made a new page "Secondary ENG" and translated that to German but when i use that in the block then it will point to English in ATE as well. But if i do exactly the same but use the first page i made "Subpage ENG" it will point to the German version in ATE as it should.

Is there anything missing as it seems still to be very inconsistent.

Kindly.

test3.png
test2.png
test1.png
January 29, 2024 at 5:01 am #15235341

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the updates. I'll check again and 'll get back to you accordingly.

January 29, 2024 at 1:06 pm #15238429

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience, I am still working on it and 'll get back to you accordingly.

January 30, 2024 at 7:57 am #15241749

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation.

I discussed the issue with the team and turns out that this is a limitation. We can't adjust the URL inside the block attribute automatically.

You'll have to translate the links manually in Advanced Translation Editor.

P.S.: This is known by our team as a new feature request. But there's no ETA so far.