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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Dynamically set locale in querybuilder

Avatar

Level 1

Hello there!
I'll try to make it fast and simple:
I created some queries to find specific content, every query has its own "path=/content/x". But from now the site will have two language, italian and english, so two different path for different content. Before the internationalization I've always set the path field hardcoding "/content/nameproject/en/us/" (if I was looking for pages) or "/content/dam/nameproject/"(for assets). I'm aiming to do something like this => if I visit the italian page every query should have this path "/content/nameproject/it/it-it/" and if I visit the english page this should be the path "/content/nameproject/en/us/"

 

1 Reply

Avatar

Level 8

Do you have any page properties which identifies the locale and language information, if not have some configurations on the root level and read them in your code using inherited page properties, then try to form the path dynamically, this should you path dynamic and query to be executed dynamically.

For more examples on inheritedpageproperties refer this.

https://sourcedcode.com/blog/aem/aem-quick-reference/aem-inheritedpageproperties-with-sightly-jsp-os...