1

I want to change the website language based on the geo ip data based on this article: https://ggullentops.blogspot.com/2018/05/sitecore-context-language-geo-ip-location.html

I added my custom language processor like this and add necessarily code to get the country and set a new context language:

<startAnalytics>
   <processor patch:after="*[@type='Sitecore.Analytics.Pipelines.StartAnalytics.StartTracking, Sitecore.Analytics']" type="your-language-resolver, .." />
</startAnalytics>

Issues:

  • If my custom processor derives from RenderLayoutProcessor then the code isn't executed.
  • If I don't derives then code is executed but Sitecore.Context.Language still not changed when open the website.

I'm not able to figure which is the best place to change the language and also have Tracker information about country available.

  • What version of Sitecore are you on? – Mark Cassidy Jan 13 at 13:44
  • Sitecore.NET 9.0.0 (rev. 171002) – Constantin N Jan 13 at 13:58
  • I think renderLayout is now for aspx pages only. Better check "mvc.render..." pipelines – Marek Musielak Jan 13 at 14:04
  • Has anybody got solution for this? – NewbieHere Jan 17 at 9:47
0

Founded the solution. Custom language resolver should be added into mvc.requestBegin, here we have all information about Tracker.

<pipelines>
        <mvc.requestBegin>
            <processor patch:after="processor[@type='Sitecore.Mvc.Analytics.Pipelines.MvcEvents.RequestBegin.StartTracking, Sitecore.Mvc.Analytics']" 
                       type="your-language-resolver ..."  />
        </mvc.requestBegin>
    </pipelines>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.