On the subject of “for future reference” and “note to self”, when needing to change language branch on the current context (HTTP request or in a scheduled job) in EPiServer:
EPiServer.BaseLibrary.Context.Current["EPiServer:ContentLanguage"] = new CultureInfo("no");In this case DataFactory methods such as GetPage will default to returning pages in Norwegian. These methods all have overloads with an ILanguageSelector as a parameter, but in case one for some reason don’t want to or is able to use them the above snippet seems to work well and comes in handy.
PS. For updates about new posts, sites I find useful and the occasional rant you can follow me on Twitter. You are also most welcome to subscribe to the RSS-feed.
Similar articles
- EPiMVC – A framework for using EPiServer CMS with ASP.NET MVC
- Sweet EPiServer Templating with TypedPageList
- EPiServer integration patterns
- Custom routing for EPiServer content
- Creating a Custom EPiServer Property with a Custom Class as Value
- Building a search page for an EPiServer 7 site with EPiServer Find
- EPiServer and MVC – What is the view model?
- How to create a custom EPiServer property
My book
Want a structured way to learn EPiServer 7 development? Check out my book on Leanpub!
Comments
comments powered by Disqus