London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Language aware ContentSelector widget

Vote:
1

Hi

I'm using a epi-cms/widget/ContentSelector outside standard CMS context, inpsired by https://gist.github.com/mvirkkunen/10484486. This works fine when using only one language.

The problem is I want to control the language-filter in the selector. If I understood the underlying mechanisms correctly, the widget itself has no control over this, but rather is determined server-side in the REST-store.

If I change language in edit mode, e.g. go to /EPiServer/CMS/?language=xxx, the selected language is reflected in my selector. This led me down the disassembly path, and ultimately to calls such as:
SystemLanguage.Instance.SetCulture("xx")
ContentLanguage.Instance.SetCulture("xx")
ContentLanguage.PreferredCulture = culturexx
ContextCache.Current["EPiServer:ContentLanguage"] = culturexx

None of these methods made any difference when called from my controller, in all thinkable extension points.

Neither did trying to publish to dojo topics such as "/epi/shell/context/updateRequest" or "/epi/cms/action/viewsettingvaluechanged"

Any pointers in the right direction would be greatly appreciated

#203750
Edited, May 06, 2019 15:48
Vote:
0

Hi,

Did you already try publishing to /epi/shell/context/request?

There is some information in the documentation here: https://world.episerver.com/documentation/developer-guides/CMS/user-interface/Context-sensitive-components/#ChangeCurrentContext

#203758
Edited, May 06, 2019 19:49
Vote:
0

Yes, even with a language-specific id like publish("/epi/shell/context/request", [{ uri: "epi.cms.contentdata:///5_276" }])

I can see xhr calls to /EPiServer/cms/Stores/contentstructure/5 and /EPiServer/cms/Stores/contentstructure/?referenceId=5&query=getchildren&typeIdentifiers=episerver.core.pagedata which leads me to EPiServer.Cms.Shell.UI.Rest.Internal.ContentStore (gist

The language is resolved (i think) with this line: parameters1.PreferredCulture = allLanguages.Value ? null : this._languageResolver.GetPreferredCulture(); which in turn uses ContentLanguage.PreferredCulture.

#203789
May 07, 2019 12:25
* 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.