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/"
Views
Replies
Total Likes
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.
If the project has more requirements for language-specific configurations, paths etc. it might be worth to explore context-aware configurations.
that way all configs related to italian site can stay in that content hierarchy. The common code could use this configs and return appropriate results
where is your query builder related logic written? is it at component level model or service or at the servlet level?
1. if the your custom code is written on sling model /service level, then you can get the current page path and split the path to identify the languagecode/locale then construct the root path dynamically.
2. If you're writing your logic at servlet, then you can pass thelanguagecode/locale as parameters and construct the root path dynamically.
Hope this helps.
@lezzowski1 It depends how your query is being constructed. You can add query construct logic on page level, where in it can fetch current path as query path and so on.
Views
Likes
Replies