AI OnAI Off
PageData langPage = Global.EPDataFactory.GetPage(pageObject.PageLink, new LanguageSelector("EN"));
String pagename = langPage.PageName;
If you do it this way, it smart to put the GetPage in a try/catch, to prevent a possible LanguageNotFoundException to be thrown if the page does not exist in the requested language.
Regards,
-Geir Allan Hove
This is the way to get the page in a specific language. You have to make sure the page exists in English or the language you are trying to retrieve.
LanguageSelector selector = new LanguageSelector("EN");
PageData thePage = EPiServer.Global.EPDataFactory.GetPage(pageObject.PageLink, selector );
private String CreateDiv(PageData pageObject) { EPiServer.Core.LanguageContext.Current.ChangeLanguageSelection("EN",true); // Is this the way to change the language? String pageDisplayName; if (pageObject.PageLink == Configuration.StartPage && StartPageName.Length > 0) pageDisplayName = StartPageName; else pageDisplayName = Abbreviated(pageObject.PageName); return pageDisplayName; }
Thank you. Regards, Victor