Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

Custom RequestLocaleResolver

armandokg
Level 1
Level 1

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?

2 Replies
victor_toledo_3
Level 3
Level 3

Hi @armandokg ! have you resolved this problem? i had a similar one and would like to know what approach you used to change the jcr:language.

Thanks in advance

victor_toledo_3
Level 3
Level 3
Hi @armandokg ! have you resolved this problem? i had a similar one and would like to know what approach you used to change the jcr:language. Thanks in advance