Custom RequestLocaleResolver

armandokg 22-01-2019

Hello, I wanted to to change the request locale based on which page it is trying to load, my approach was to create a custom RequestLocaleResolver and fair enough the request locale was change to the desired locale, now comes the tricky part. The whole idea behind this is to set the request locale so the i18n filter will use that locale to find the correct translation, when printing (in HTL) the value of request.getLocale().getLanguage() I get my previously defined locale (which is fine), and currentPage.getLanguage() returns the locale set in the jcr:language property.

My question is, how can I correctly override the locale in that scenario so that I get the translation I want based on the overridden locale?

Accepted Solutions (0)

Answers (0)