Try our conversational search powered by Generative AI!

Own language selector


In EPiServer EDIT page, where you create new pages, you have a dropdown box at the bottom of the left menu that shows all the supported languages of the site. I need an own dropdown box in my startpage that shows exactly the same languages as the dropdown box in edit mode. How do I retreive the supported EPiServer languages from my code and populate my dropdown box with these?


Nov 28, 2010 11:27
PageDataCollection languagesForSomePage = EPiServer.DataFactory.Instance.GetLanguageBranches(somePageLink);

I usually do it like that. Then check pagedata.LanguageBranch for each item in the collection.


Edited, Nov 28, 2010 12:48

Thanks Johan,
Your code work fine, now I get the supported language codes, like "en", "sv" etc. But in episerver edit mode, at the "Show page tree:" dropdown list I can see the full name of the language, like "English", "Svenska" etc. Ofcourse I can do an own translator of the codes but I prefer to use the same translator as EPiServer use for this. Do you know how to do this, I do I get "English" instead of "en"?

Nov 30, 2010 12:48

You should have that as a property on LanguageBranch:

LanguageBranch branch = LanguageBranch.Load(pagedata.LanguageID);

Nov 30, 2010 12:52

Yiihaa, Thanks alot Johan, that solves my problem.

Nov 30, 2010 13:35
* 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.