UrlSegmentProviders and the current culture (SEO Metadata playing nice with Vorto)
I've been asked to look at supportingVorto in the SEO Metadata plugin I maintained. I'm not very familiar with anything multilingual, so please bear with me.
SEO Metadata is essentially a large property editor with a field that allows for a URL name to be entered, and a UrlSegmentProvider which will enable this field. Vorto is a property wrapper that allows different "copies" of the property to be made for each configured culture.
At rendering stage, you can obtain the current culture through Thread.CurrentThread.CurrentUICulture. Vorto uses this to determine which one of the "copies" to use when requesting the wrapped data.
To support Vorto, my UrlSegmentProvider deserialises the Vorto data into a dictionary where the key is the culture. I wanted to get the SEO metadata for the current culture for the page, except this doesn't seem to be directly possible.
The CurrentUICulture is always en-GB (probably the culture of the logged in user?)
The IContentBase passed to the UrlSegmentProvider doesn't have a culture assigned to it.
The GetUrlSegment(IContentBase, CultureInfo) is never used (cannot find any usages - 7.2.5).
My latest attempt at a workaround I have at the moment is to try and obtain a published version of the page (or it's parent if unpublished) and then call .GetCulture() on that. This doesn't appear to work either (still getting en-GB), probably as it isn't within the context of a site page request.
My questions are:
Is this the only way you can obtain the culture of some content? Is there a better way?
Will the core ever call the IUrlSegmentProvider.GetUrlSegment(IContentBase, CultureInfo) method? There doesn't appear to be any any usages of it.
Thanks for raising the issue. My investigations were preliminary based on a multilingual build that never materialised, so I never really pursued this further (other real world work 😀).
I have every faith Stephan can resolve it, although looks like we will have to wait until v8 for that.
UrlSegmentProviders and the current culture (SEO Metadata playing nice with Vorto)
I've been asked to look at supporting Vorto in the SEO Metadata plugin I maintained. I'm not very familiar with anything multilingual, so please bear with me.
SEO Metadata is essentially a large property editor with a field that allows for a URL name to be entered, and a
UrlSegmentProvider
which will enable this field. Vorto is a property wrapper that allows different "copies" of the property to be made for each configured culture.At rendering stage, you can obtain the current culture through
Thread.CurrentThread.CurrentUICulture
. Vorto uses this to determine which one of the "copies" to use when requesting the wrapped data.To support Vorto, my UrlSegmentProvider deserialises the Vorto data into a dictionary where the key is the culture. I wanted to get the SEO metadata for the current culture for the page, except this doesn't seem to be directly possible.
IContentBase
passed to the UrlSegmentProvider doesn't have a culture assigned to it.GetUrlSegment(IContentBase, CultureInfo)
is never used (cannot find any usages - 7.2.5).My latest attempt at a workaround I have at the moment is to try and obtain a published version of the page (or it's parent if unpublished) and then call
.GetCulture()
on that. This doesn't appear to work either (still getting en-GB), probably as it isn't within the context of a site page request.My questions are:
IUrlSegmentProvider.GetUrlSegment(IContentBase, CultureInfo)
method? There doesn't appear to be any any usages of it.Hi Ryan,
Did you ever find a answer to your question ? I'm having the same issues. The method with culture parameter is never called.
Dave
Hi Ryan,
I created a issue for this : http://issues.umbraco.org/issue/U4-7130
Please vote it up.
Dave
Thanks for raising the issue. My investigations were preliminary based on a multilingual build that never materialised, so I never really pursued this further (other real world work 😀).
I have every faith Stephan can resolve it, although looks like we will have to wait until v8 for that.
is working on a reply...