Copied to clipboard

Flag this post as spam?

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


  • MuirisOG 382 posts 1284 karma points
    Aug 14, 2019 @ 10:05
    MuirisOG
    0

    Populate Language Variant with existing doctype fields

    I've just migrated the v7.15.1 database to v8.1.1, and would like help with populating the language variant with existing doctype values.

    Our old site had English fields and Welsh fields all in one doctype.

    I would like to remove the Welsh fields after populating a Welsh language variant.

    Any help in how to go about this would be very much appreciated.

    Can it be done in code?

    Thanks Muiris

  • Kevin Jump 2310 posts 14695 karma points MVP 7x c-trib
    Aug 14, 2019 @ 11:23
    Kevin Jump
    0

    Hi Muiris,

    If you want to move the property values from the welsh properties and put them into the variants?

    then it's probably a code thing as its quite specific.

    you will need to load up each content item get the values from the welsh fields and then set them in the variant one doing

    item.SetValue(alias, value, culture)
    

    so that might be something like (assuming item is an IContent item)

    var value = item.GetValue("welshTitle");
    item.SetValue('pageTitle', value, 'cy');
    

    bit of a pain :( - depending on content this may be to much work.


    hacky wise you might be able to do this using uSync.ContentEdition and manipulating the files - if will dump all the content into .config files in the uSync folder, and you could if you're into that sort of thing manipulate the files to move the welsh values into the variant values, and then import them. Again depends on your setup.

  • MuirisOG 382 posts 1284 karma points
    Aug 14, 2019 @ 14:41
    MuirisOG
    0

    Many thanks, Kevin, this is just what I need.

    I've had experience writing code to import data when we moved from our old CMS to Umbraco 7.5.14, and even though it is a pain, I'd much prefer to do it in code.

    Muiris

Please Sign in or register to post replies

Write your reply to:

Draft