Copied to clipboard

Flag this post as spam?

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


  • Josip 187 posts 652 karma points c-trib
    Jul 30, 2019 @ 10:53
    Josip
    0

    Route for multilingual page

    Hi all,

    I cant figure out how to create route for multilingual public member page. For now i have route only for one culture supplier-profile/{id}, but i need it also for this one en/supplier-profile/{id}

    public class SupplierProfileRoute : ComponentComposer<RegisterCustomRouteComponent>
    {
    
    }
    
    public class RegisterCustomRouteComponent : IComponent
    {
        public void Initialize()
        {
            RouteTable.Routes.MapUmbracoRoute("SupplierProfile", "supplier-profile/{id}", new
            {
                controller = "SupplierProfile",
                action = "SupplierProfile",
                id = UrlParameter.Optional
            }, new UmbracoVirtualNodeByIdRouteHandler(1140));
        }
    
        public void Terminate()
        {
            throw new NotImplementedException();
        }
    }
    
  • Erik-Jan Westendorp 29 posts 287 karma points MVP c-trib
    Jul 30, 2019 @ 11:04
    Erik-Jan Westendorp
    0

    Hi Josip,

    Did you configure culture and hostnames?

    enter image description here

  • Josip 187 posts 652 karma points c-trib
    Jul 30, 2019 @ 11:09
    Josip
    0

    Hi Erik-Jan,

    yes i did, it looks the same like on your screenshoot.

  • Josip 187 posts 652 karma points c-trib
    Jul 30, 2019 @ 11:26
    Josip
    100

    Ok i found the solution, it was simple.

    If someone have better idea, please post it here.

    I have created one more route under the first one like this:

     RouteTable.Routes.MapUmbracoRoute("SupplierProfileEn", "en/supplier-profile/{id}", new
                {
                    controller = "SupplierProfile",
                    action = "SupplierProfile",
                    id = UrlParameter.Optional
                }, new UmbracoVirtualNodeByIdRouteHandler(1140));
    

    This is the only thing i changed :"SupplierProfile", "supplier-profile/{id}" to "SupplierProfileEn", "en/supplier-profile/{id}"

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies