Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!
SOLVED

How to get localized tag tile in htl

Avatar

Level 3

Hi I have a component where I need to get tags and render their localized titles. I have localized titles for tags and I would like to access those localized value, but not sure how to any suggestions please?

Screen Shot 2022-03-28 at 11.40.28 AM.png

HTL

<ul>
<li data-sly-repeat.tag="${relatedTags.iterator}">
${tag.title}
// get localized title
</li>
</ul>
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @bpeddapudi, you can try below code, it will list all available localized values for given tag. To get more control you can move your code into Sling model.

<ul>
   <li data-sly-repeat.tag="${relatedTags.iterator}">
   ${tag.title} <br />
   // get localized title
   <sly data-sly-list="${tag.localizedTitles.entrySet}">
      ${item.value} <br />
   </sly>
   </li>
</ul>

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @bpeddapudi, you can try below code, it will list all available localized values for given tag. To get more control you can move your code into Sling model.

<ul>
   <li data-sly-repeat.tag="${relatedTags.iterator}">
   ${tag.title} <br />
   // get localized title
   <sly data-sly-list="${tag.localizedTitles.entrySet}">
      ${item.value} <br />
   </sly>
   </li>
</ul>