Episerver is not returning the correct language

  • Page Owner: Not Set
  • Last Reviewed: 2019-09-12

My Episerver site is randomly not returning the correct language, what is the deal?


Additional Posts

I've ran into this a few times now and figured I'd make a post about it to share my solution and maybe get a better solution from somebody. When you're working in a multi-lingual site, Episerver relies on the language code in the request to know what language version of properties to use. When you make an AJAX call Episerver goes to the default language because there is no language identifier in the URL.

So basically what I do is pass the current language as a parameter with my AJAX call. Then I set the Language manually using ContentLanguage.

Something like:

 ContentLanguage.PreferredCulture = new CultureInfo(language);