GetPageLanguage and GetPage returning wrong language


HI guy any help with this is greatly stumped at this point.

I have one page with two language versions (English and French) with the title being "FAQ". I changed the page title on the english side to say "FAQee" and french title is still "FAQ" saved and published...

they show up perfectly fine in the cms so now i went to collect the information and found that regardless of the current page language id GetPage and GetPageLanguage always returns the last published page version. so if french was published last...thats what i get back.

LanguageSelectorContext.SelectedLanguage shows that the alternate language does actually exist...


anyone know what im doing wrong?


thanks in advance guys!



LanguageSelector lng = new LanguageSelector(CurrentPage.LanguageID);

//try to get the page in the current language
PageData data = null;
data = DataFactory.Instance.GetPage(new PageReference(pageReference), lng);

//see if the language actually exists
LanguageSelectorContext langContext = new LanguageSelectorContext(data);

//try to change to the current language AGAIN
data = data.GetPageLanguage(CurrentPage.LanguageID);



Mar 21, 2012 16:11

I think you should use .LanguageBranch instead of .LanguageID...

Mar 24, 2012 0:44

didnt work. i am still getting the same results.

Mar 28, 2012 16:21

PageDataCollection languagesForCurrentPage = EPiServer.DataFactory.Instance.GetLanguageBranches(CurrentPage.PageLink);

That will get you all language versions of CurrentPage...

You can loop or do whatever, sort it by date etc:

                foreach (PageData pd in languagesForCurrentPage)
                    if (!CurrentPage.LanguageBranch.Equals(pd.LanguageBranch))

Mar 28, 2012 16:29

thanks... GetPageLanguageBranches did the trick...i dont understand why the other API calls did not return the correct page version...??

Mar 28, 2012 20:44
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.