Skip Navigation

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

Last updated by davidS-113 1 year, 6 months ago.

Assisted by: Prosenjit Barman.

Author Posts
March 5, 2023 at 5:03 pm #13174051

davidS-113

I have a german page with anchor links in the navigation. The link target is a Gutenberg block on this page.

I am able to translate everything with the Advanced Translation Editor, menu synchronization and string translation. But when I change the link target (e.g. from example.com/#german-anchor-link to example.com/#english-anchor-link), of course the link on the English page doesn't work anymore, because the link target (Gutenberg block) still has the german ID.

Is there a solution for this?

Thank you very much!

March 6, 2023 at 1:19 pm #13179193

Prosenjit Barman
Supporter

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hello There,
Thanks for reaching out to us. I will try my best to assist you in this matter.

I'm sorry to inform you that I'm still not completely clear about the issue you are facing. Would it be possible for you to share the link to the site or a specific page where I can check the issue further?

I will get back to you with an update on this matter as soon as I can. Looking forward to your response.

Best Regards,
Prosenjit

March 6, 2023 at 1:43 pm #13179437

davidS-113

Hi Prosenjit,

I hope the attached image makes it easier. I want to translate the menu and urls completely to English. Thus, I need to adjust the url as follows:

#some-german-text
#some-english-text

If I then switch to the English version via the language switcher, the link no longer works. Because in the source code the element to scroll to still has the German ID of course, for example:

<div id="some-german-text">link target</div>

Bildschirmfoto 2023-03-06 um 14.28.44.png
March 8, 2023 at 5:54 am #13195255

Prosenjit Barman
Supporter

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hello There,
I hope this message finds you well.

Thanks for clarifying the issue. It is very clear to me right now.

For your information, WPML does not translate id or classes. Therefore, you'll need to manually translate the English content and include the relevant IDs for the respective elements.

I have made a video for you describing the process. Kindly check this video(hidden link) and make the adjustments accordingly on your site.

I hope this helps. Please let me know how it goes or if you need any further assistance. I'll be happy to help you. 🙂

Best Regards,
Prosenjit

March 9, 2023 at 7:43 am #13203967

davidS-113

Is it possible to reopen the support ticket?

I am sorry to inform you that the recommended instructions do not work.

I have adjusted the IDs (HTML anchors) on the English page (without Advanced Translation Editor) as you described. At first this worked as well. However, when I now make changes on the original page (German) and translate the texts with the Advanced Translation Editor, the adjusted ID is overwritten again.

Is there any solution?

Otherwise, when using WPML, anchor links that are readable by the user cannot be used. For example, this URL would need to be customized as follows to remain readable in all languages:

example.com/#about-us
example.com/#2

March 13, 2023 at 5:10 am #13228079

Prosenjit Barman
Supporter

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hello There,
I hope this message finds you well. I apologize for the delay in my response, as I was away for the weekend and on vacation. I'm very sorry for any inconvenience you had in the meantime.

I clearly understood the issue you're having. If you want to scroll to an anchor on a specific page, it is always recommended to manually translate that specific page and insert the ID on the anchor element, not using the Advanced Translation editor as it can't translate IDs and potentially, can replace the contents of the ID field.

Since the anchor not working for you in the secondary language, you need to disable the Advanced Translation editor for that specific page and need to add the ID manually by taking the manual translation approach. Kindly check this video(hidden link) for a better understanding.

Please note that each time you use the Advanced Translation Editor to translate the content of that particular page, you need to manually enter the ID for the relevant anchor element each time to ensure that scrolling to the anchor works properly.

Please try and let me know if that works. If you need further help, do not hesitate to let me know. I will be happy to help.

Best Regards,
Prosenjit

March 13, 2023 at 6:39 am #13228359

davidS-113

My issue is resolved now. Thank you!

But I think WPML should develop a better solution for this. The current approach is a bit cumbersome and errors can easily occur when multiple people are working on the homepage.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.