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

SOLVED

How to get localized tag tile in htl

Avatar

Level 2

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

0 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>