Condition based on translated URL structure from Weglot

Hi

We are using Weglot to translate our website and they translate the site by adding the locale to the URL structure.

English = https://website.com**/en/**
German = https://website.com**/de/**

… and so on.

Is there a way to create conditions on elements depending on the URL, so that we can have dynamic content based on languages?

Thanks.

Br. Mathias

Hi Mathias,

The {{dc:url:segment}} can be used here. However, the plugin may not allow the Dynamic Content tag to access the value. Please find the comment from my colleague in your older post.

Thanks

Hi @tristup

I tried using

{{dc:url:segment index=“0”}} = en
{{dc:url:segment index=“1”}} = en

But the element does not show on the /en/ path, like I would think? :thinking:

Hi Mathias,

You can get that using {{dc:url:segment}} dynamic content.

Thanks

Hi Tristrup

Please see attached screendump of the conditional. I have applied this condition to an element, but that element does not show on website.com/en/ :thinking:

Let me know what you think.

Thanks.

Hi Mathias,

Can you please {dc:url:segment}} add this in a Text element in a blank page and check what exactly it is returning? If that is returning en you can use that in the condition.
If not, please provide login credentials for your site in a secure note to examine it further, including:

– WordPress Site URL & Login URL
– WordPress Admin username/password

To create a secure note, click the key icon underneath any of your posts.

NOTE: Please remember that we don’t offer support to the 3rd Party plugins and related issues.

Thanks

Done. Thanks :+1:t2:

Hello Mathias,

What is the Danish URL of the “language test” page? We want to check the page and see why /en/ was not picked up by the dynamic content. By the way, do these documentations apply:

Cheers.

Hi ruenel

The Danish URL is /language-test/ (without the /en/) :slightly_smiling_face:

I think you need to switch language from the language switcher in the footer in order to get there?

Hi Mathias,

It seems it might be with the URL structure of the plugin you are using, and that is why it can’t be fetched by dynamic content. Although it is a 3rd Party plugin issue, we are still curious to know why the dynamic content is not able to fetch the segment.
I will discuss it with our development team and let you know about it.

Please note that we do not guarantee a fix or compatibility for 3rd Party plugins.

Thanks

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.