Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

block editor and disabling strictlanguagerouting

Vote:
 

Hello,

We have a problem with a site where we for different reasons needed to turn off strict language routing.

Everything works fine, except for our block preview controller, which is copypasta from the alloy preview controller.

The entire site has fallback for all languages from english, set on the root page.

Now, I have a page in english and swedish, and on that a content area that is not culture specific (so the editor have to translate the individual blocks instead of the layout). I add a block on the english page that only have one xhtml string property that is culture specific, it is rendered in the block view itself as @Html.PropertyFor(m => m.Text).

Next I change language in edit mode to swedish and use the Translate option on the hamburger menu for my block. I add some text in swedish and publish.

All is working for visitors and editors on the page at this point.

Next I again edit the block, still being in the swedish language, and once the block editor (preview controller) loads, the text displayed is the english version. If I click the text to get the editor, the swedish text is shown. If I change the text to the propertyrenderer controller makes its ajax roundtrip to the server so to speak, the swedish text is shown.

If I set strictlanguagerouting=true, this do not happen and everything works as expected. Anyone know how I can resolve this, or if some bugfix have been made?

We are using EPiServer CMS 7.13.3 and UI 7.12.1

I managed to temporarily solve it using the code below, but it is very hack-ish and will probably break something somehwere... Is there a better way of doing this?

	[InitializableModule]
	public class testlasse :IInitializableModule
	{
		public void Initialize(InitializationEngine context)
		{
			ContentRoute.RoutingContent += RoutingContent;
		}

		private void RoutingContent(object sender, RoutingEventArgs routingEventArgs)
		{
			if(routingEventArgs.RoutingSegmentContext.RequestUrl.OriginalString.IndexOf("CMS/Content/contentassets/", StringComparison.InvariantCultureIgnoreCase) > -1
				&& (routingEventArgs.RoutingSegmentContext.ContextMode == ContextMode.Edit || routingEventArgs.RoutingSegmentContext.ContextMode == ContextMode.Preview)) {
				routingEventArgs.RoutingSegmentContext.StrictLanguageRoutingResolver = () => true;
			}
		}
		
		public void Uninitialize(InitializationEngine context){}
		public void Preload(string[] parameters){}
	}
#113955
Dec 02, 2014 11:49
* 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.