I was at a client site the when a question was asked about how to personalise content using the selected language. The scenario is as follows:

  • Site editor(s) publish content on a global branch for example English /en/
  • Both /en-GB/ and /en-US/ fall back to /en/ and share content for most of the site (some individual country content is published)
  • The site is accessed using fallback languages for example English GB /en-GB/ and English US /en-US/
  • The client wanted to personalise content for /en-GB/ and /en-US/ in the /en/ page

I realised that this wasn't possible as we can only personalise on where we think the user is (Geographic Coordinate and Geographic Location criterion) not on what they tell us by selecting a language on the site. 

So I set out to create a "Selected Language" visitor group criterion. This is a simple criterion that allows site editors to personalise based on what language a page is being viewed in:

Selected Langauge Visitor Group Criterion

The source code is available as part of the Criteria Pack on Codeplex. It will also be available on the Nuget.episerver.com.


Comments