Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

How to retrieve all languages of a page with DOJO?


I've built a custom component, it's being used on the dashboard.
My site exists on several different languages, it's setup like this: - english - swedish - danish

I have a page named mypage that exists in three different languages, the url is different depending on language, examples:

In my component I'm using the contentselector, "epi-cms/widget/ContentSelector".
Now, say that Im on in edit mode, language is english, when I open the ContentSelector(showAllLanguages is set to true) I want the editor to be able to select a specific language of a page, let's say the danish version.
So, my goal is that when the editor opens the ContentSelector, he/she would see that MyPage exists in three different languages and be able to choose the danish version, I would then like to retrieve the absolute url to it, in my example that would be

However, when I open up the ContentSelector, I can only see the english version of the page(I guess because it's context based and my "UI-language" currently is English.

So, my question is: is it possible to pass in a language to the ContentSelector? Or do I need to switch context somehow in edit mode?
I guess it's not possible to pass in a language to the ContentSelector, so my next question is, given a contentreference, can I somehow retrieve all different languages versions of a page with DOJO? Im guessing that I should use either the "epi.cms.contentdata" or "epi.cms.contentversion" store somehow?

Pseudo code:
var myContentReference = 1337;
var result = someStore.getAllLanguageVersionsOfPage(myContentReference);
// result contains all different versions together with all different urls to said page.

Edited, Oct 28, 2017 0:06


No unfortunately there is no easy API call to get all language versions of a page. The closest to what it sounds like you want to do is probably to use the content data store ("epi.cms.contentdata").

When getting a content from that store, the object returned contains a property called existingLanguageBranches. That property is an array that contains some information regarding each language which includes a version specific contentLink. Perhaps that is something you can use to build the urls to the different pages.

Oct 31, 2017 9:53

Yeah, I've already tried using the contentdata-store and the existingLanguageBranches array. The problem is that I can only get the urlsegment there, for example "/en/", I can't get the different hostnames...right now im using the SiteDefintitionRepository to get all available hostnames.
The problem is when Im opening the contentselector, the context of the selector will be "en" for example if im on Ideally I would like to be able to pass in "sv" or something similar to the contentselector and thus get the contentselector to show me all pages existing in swedish... :)

The component im building is a redirect component where I want the editor to be able to select the target site using the contentselector. This works fine if the site only has one host specified, but I run into some problems if more hosts exists because I want the editor to be able to create a redirect from to for example...that's why I need to be able to fetch all different language versions so the editor can select the appropiate url...

Edited, Oct 31, 2017 10:28

OK, I think I understand now.

It sounds like it would be best for you to create a custom store so that you can resolve the URL's on the server using IUrlResolver. Send in a contentLink and get all existing language URLs back.

Oct 31, 2017 10:45

Hmmm...that sounds interesting! Do you have a link to the documentation regarding custom stores? I know I had that thought before but I couldn't find any pointers of how to implement a custom store when I looked in the documentation...
Thank you for your help, really appreciate it.

Or custom store...I could just build an api endpoint I guess... :)

Edited, Oct 31, 2017 10:48

Hmm, we seem to be missing some documentation in this area. That must be the first time that happened ;)

But I found this old documentation. It's old but it should still work:

The only thing missing is the registration of the module initialization. Grzegorz mentions in this thread on how to do that:

I'll report a documentation bug on it to make sure we provide a more up to date version of how to set up a rest store.

Oct 31, 2017 11:35

Haha yeah, definetly a first ;)
Thank you so much, this will finally allow me to release my component to the public...expect a blog post in a week or two.. :D

Oct 31, 2017 11:37
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.