November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Which EPiServer version are you using (suspicios looks LanguageSelector)? Can't recall in which version was that used. Just tested in 8.x -> PageName contains correct (translated) name of the page.
Hi Esben,
Maybe you are loading page for specific version, where there is no language branch. Try to use ToReferenceWithoutVersion extension method.
var pd = ServiceLocator.Current.GetInstance<IContentRepository>().Get<PageData>(pageId.ToReferenceWithoutVersion(), new LanguageSelector(language));
If this wont help, then you could try to load the page and debug what language and what languageBranch was loaded. Also load all available language branches for the page.
var pd = ServiceLocator.Current.GetInstance<IContentRepository>().Get<PageData>(pageId, new LanguageSelector(language)); var displayName = pd.PageName // this returns the name in the master language var language = pd.Language; var branch = pd.LanguageBranch; var languageBranches = ServiceLocator.Current.GetInstance<IContentRepository>().GetLanguageBranches<PageData>(new pageId); foreach (var languageBranch in languageBranches) { }
Hi Valdis and Grzegorz
I am using 7.5. Grzegorz pointed me in the right direction with the remark about loading a page for a specific version. In turned out, that I had loaded a version where the page name wasn't translated, so it still appeared in the master language. I used an instance of IContentVersionRepository to get the newest version, and now the page name is translated.
Thank you both for sharing your ideas!
This should be easy: I retrieve a PageData object in a specific language via the content repository. Now I would like to display the name of the page in that specific language. How do I get this page name? I have tried using PageName, but this propery returns the page name in the master language.