Copied to clipboard

Flag this post as spam?

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


  • Stefan Verdonschot Van Elsen 5 posts 95 karma points
    Nov 06, 2017 @ 10:02
    Stefan Verdonschot Van Elsen
    0

    Hi all, For a site we're building i'm trying to implement multi language with a language selector that goes to the same page (if exists). Now when creating a new language, i can copy the entire site from eg EN, set the new site to nl language en get going. However when i relate to the original, the nl site is indeed linked to the EN site, but the EN site was already linked to FR and DA. Now for the new NL site i have to manually create all the links. Is there an 'easier' way so when copying an entire site, also all the other relations get copied? I was also thinking of using an sql script to set the links. Any thoughts or suggestions?

    Thanks in advance!

  • Kevin Jump 2310 posts 14695 karma points MVP 7x c-trib
    Nov 06, 2017 @ 10:49
    Kevin Jump
    101

    Hi Stefan,

    just to confirm, your NL site is related to you EN one, but you also want it related to your FR and DA one is that right ?

    if so i would suggest you go through the relations service to get the links.

    While you could use this to create direct relationships between NL and FA/DA i think long term it might be more sustainable for you if instead your lookup code was to get the parent relation of the current page using:

    var pagerelations =  _relationsService.GetByChildId(yourCurrrentpageId)
    

    So for an NL page this will get you the related pages from the parent (the EN site) and then use that to get the child relations of the EN page (so all the relations across the site).

    foreach(var relation in pagerelations)
    {
       var languageRelations = _relationsService.GetByParentId(relation.ParentId);
    }
    

    this way you can do the copy and relate thing to create a new site, but you don't have to build relationships between everysite just the parent.

    * *if you are on the parent page you should get nothing back for the first call to GetByChildId, but then the parentId call will still work with the current page id as the parameter

Please Sign in or register to post replies

Write your reply to:

Draft