Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I've created a controller and I inject IUmbracoContextFactory
When I use Content.GetByRoot with a culture parameter, I get content of the default language rather than the culture I requested.
using (var cref = this.umbracoContextFactory.EnsureUmbracoContext()) { var contentX = cref.UmbracoContext.Content.GetByRoute("/some-page-url",culture:lang); return Ok(contentX); }
Any suggestions about what might be wrong?
I found this https://our.umbraco.com/forum/umbraco-8/96665-get-content-based-on-accept-language#comment-310873
It uses a variationContextAccessor and seems to work
this.variationContextAccessor.VariationContext = new VariationContext(lang);
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Not sure what I'm doing wrong with UmbracoContext.Content.GetByRoute
Hi,
I've created a controller and I inject IUmbracoContextFactory
When I use Content.GetByRoot with a culture parameter, I get content of the default language rather than the culture I requested.
Any suggestions about what might be wrong?
I found this https://our.umbraco.com/forum/umbraco-8/96665-get-content-based-on-accept-language#comment-310873
It uses a variationContextAccessor and seems to work
this.variationContextAccessor.VariationContext = new VariationContext(lang);
is working on a reply...