Copied to clipboard

Flag this post as spam?

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


  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Jan 06, 2016 @ 01:11
    Nicholas Westby
    0

    Ditto with Polyglot?

    I typically build my international sites with a tool called Polyglot: https://our.umbraco.org/projects/backoffice-extensions/polyglot/

    Basically, it allows you to create your pages in your default language (say, English), then it creates a subnode under each page called "Translations" and under that are nodes particular to each language that you translate to. Using some URL rewrites and conditional checks to look for child nodes, the content with the appropriate language will be shown (it falls back to the default language if no translation exists).

    Is there any easy way to make Ditto map content structured in this way?

    My guess is I'd just have to choose which node to use (e.g., the current page or one of the child translations) and map that. However, then I couldn't do fallbacks for particular properties (i.e., I'd be stuck with one node... all or nothing).

    What I'm hoping is that the code in Ditto that calls "GetPropertyValue" is swappable (e.g., perhaps I can have it call my "LocalizedPropertyValue" alternative).

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Jan 07, 2016 @ 11:08
    Lee Kelleher
    0

    Hi Nicholas,

    I haven't used Polyglot myself, so not sure of the finer details.

    In terms of swapping out GetPropertyValue calls with your LocalizedPropertyValue call, it is possible.

    The only place that we use GetPropertyValue is in the main UmbracoPropertyValueResolver (along with the UmbracoPropertyValue attribute), see here:

    https://github.com/leekelleher/umbraco-ditto/blob/master/src/Our.Umbraco.Ditto/ComponentModel/ValueResolvers/UmbracoPropertyValueResolver.cs#L70

    In order to use your LocalizedPropertyValue, you'd need to write your own ValueResolver (probably just copy the UmbracoPropertyValueResolver one) and replace accordingly.


    Here's a similar example of how James South tackled this when using Vorto property-values:

    https://gist.github.com/JimBobSquarePants/80762a1233bbb112689e#file-vortovalueresolver-cs


    One thing to note about ValueResolvers... in the next version of Ditto, they are being replaced by a new approach called Processors. (Think of it as a combination of ValueResolvers and TypeConverters), there's a whole discussion around it on GitHub: https://github.com/leekelleher/umbraco-ditto/pull/143

    I hope this helps?

    Cheers,
    - Lee

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Jan 09, 2016 @ 20:20
    Nicholas Westby
    0

    If I'm reading the documentation on value resolvers correctly, I'd have to decorate each of my properties with my value resolver. I was hoping for more of a pipeline solution (e.g., the ability to swap out the default value resolver so it always knows the use my international version).

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Jan 09, 2016 @ 20:25
    Lee Kelleher
    0

    Yes, that's correct. Currently the default one (UmbracoProperty) can't be over replaced.

    Feel free to open an issue on our GitHub repo, we can discuss further (and be good to get Matt and James's views on it too)

    Thanks, - Lee

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Jan 09, 2016 @ 21:43
  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Jan 11, 2016 @ 09:46
    Lee Kelleher
    0

    Cool, thanks Nicholas!

Please Sign in or register to post replies

Write your reply to:

Draft