Load page from alternate language

Vote:
 

Hi all

This may seem like a bit of a strange request but I need to be able to load a page from a different language into my main site. Here is the scenario; I have one global site and lots of sub sites in different languages, these sub sites have their own news and events. On the global website they want to pull in those news and events from all of the sub sites, when you click through on one of these, it should keep you in the main site not take you to the sub site so I need the URL's to work internally, here is where the problem comes in.

I have got all of the content from the sub-sites pulling in to one list without a problem, and the links I am generating are not including the language parameter so it is generating the links that I want, however unsuprisingly when you click on one you get 'Incorrect link' shown, this is because the page doesnt exist in that language which is fine.

I have added the following block to by DefaultPageController:

if (currentPage == null)
            {
                var uri = string.Format("/nl{0}", Request.Url.AbsolutePath);
                var urlBuilder = new UrlBuilder(uri);
                object pageRef;
                Global.UrlRewriteProvider.ConvertToInternal(urlBuilder, out pageRef);
                var page = DataFactory.Instance.GetPage(pageRef as PageReference);

                if (page != null)
                {
                    currentPage = page as SitePageData;
                }
            }

    

Before I added this, currentPage was null which I figured was why I was getting an incorrect link. The new code, although for now I have hardcoded the language parameter, works and correctly sets the currentPage. From their stepping through the rest of the code, I can see that the model is succesfully created and it goes through the entire view and finishes executing, but I still get then get the same 'Incorrect link'!!! 

Does anyone know if there are any extra checks happening somewhere that may be causing this or how I could get around this problem.

Many many thanks
Dave

#75372
Sep 26, 2013 12:33
Vote:
 

Hi,


Have you tried to set the global language (I guess English?) as fallback language on the subsites/other languages?

#75546
Sep 27, 2013 22:10
Vote:
 

Hi Johan

Thanks for your response. I havent, As they all have their own events and news, I do not want all of the global site's items to appear in that site which it will do if it is a fallback. I tried to delete pages from the sub language but that deletes from the main language, not sure if there is a way around that though.

I am not sure wether that would help me though as that would show the global (en) content in the sub site, not the sub site content in the Global site.

Thanks very much
Dave

#75616
Oct 01, 2013 12:27
Vote:
 

Dave, to delete a page from just one language, load the Version gadget, and you can find that option to bottom left.

As Johan says, I would also solve this by using fallback/replacement languages.

#75619
Oct 01, 2013 13:22
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.