MultiUrlPicker does not return culture specific urls
Umbraco Version: 11.2.2
I have a multi-lingual site containing:
Content page that varies by culture
Home page the varies by culture and has a multiUrlPicker property that also varies by culture
The multiUrlPicker property on the home page points to the content page
In Umbraco the property on my home page looks like the following (on en-US and da-DK version):
I see the name and the url of the node referenced is correct.
However in my code I have the property and when I call property.GetValue("some culture code") the links that is returned always has the url value from the default language and not the url from the culture I'm passing in as argument to the GetValue method.
The name property is in the correct culture.
See examples below:
culture is en-us
culture is da-dk
Is it me doing something wrong or is this an error in Umbraco?
Parsing on the culture to property.GetValue("some culture") does give you the content for the right culture. I could see that because I ran in to the same issue with links in the RTE editor. I got the english text and the danish text depending on the culture I was parsing in.
But, I was not aware that in Umbraco when you are using Vary by culture it's not possible to link from a page in one culture to a page in another culture.
The backoffice doesn't give the editors the option to choose culture when creating a link and also Umbraco only stores the id of the page you are linking too and not the culture.
This means that when you pull up a content node in the API, the link you have on that node to another page will always be a link to the same culture as the content node you pulled up from the API.
In my case I was always loading the english version of the node and because of the the links I resolved was always to the english version of a page even though I was passing in another culture to property.GetValue("...").
I needed to set the variationContext before loading the node in order to load the node in the right culture and then everything was working.
_variationContextAccessor.VariationContext = new VariationContext(job.Culture);
MultiUrlPicker does not return culture specific urls
Umbraco Version: 11.2.2
I have a multi-lingual site containing:
In Umbraco the property on my home page looks like the following (on en-US and da-DK version):
I see the name and the url of the node referenced is correct.
However in my code I have the property and when I call property.GetValue("some culture code") the links that is returned always has the url value from the default language and not the url from the culture I'm passing in as argument to the GetValue method.
The name property is in the correct culture.
See examples below:
culture is en-us
culture is da-dk
Is it me doing something wrong or is this an error in Umbraco?
Ahh, I figured out the reason for this :-)
Parsing on the culture to property.GetValue("some culture") does give you the content for the right culture. I could see that because I ran in to the same issue with links in the RTE editor. I got the english text and the danish text depending on the culture I was parsing in.
But, I was not aware that in Umbraco when you are using Vary by culture it's not possible to link from a page in one culture to a page in another culture.
The backoffice doesn't give the editors the option to choose culture when creating a link and also Umbraco only stores the id of the page you are linking too and not the culture.
This means that when you pull up a content node in the API, the link you have on that node to another page will always be a link to the same culture as the content node you pulled up from the API.
In my case I was always loading the english version of the node and because of the the links I resolved was always to the english version of a page even though I was passing in another culture to property.GetValue("...").
I needed to set the variationContext before loading the node in order to load the node in the right culture and then everything was working.
is working on a reply...