Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ryan Lewis 8 posts 198 karma points
    Jun 02, 2015 @ 11:39
    Ryan Lewis
    0

    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.

    • 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:

    1. Is this the only way you can obtain the culture of some content? Is there a better way?
    2. Will the core ever call the IUrlSegmentProvider.GetUrlSegment(IContentBase, CultureInfo) method? There doesn't appear to be any any usages of it.
  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Sep 22, 2015 @ 18:36
    Dave Woestenborghs
    0

    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

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Sep 23, 2015 @ 06:16
    Dave Woestenborghs
    1

    Hi Ryan,

    I created a issue for this : http://issues.umbraco.org/issue/U4-7130

    Please vote it up.

    Dave

  • Ryan Lewis 8 posts 198 karma points
    Sep 23, 2015 @ 17:14
    Ryan Lewis
    0

    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.

Please Sign in or register to post replies

Write your reply to:

Draft