How to get localized tag tile in htl | Community
Skip to main content
bpeddapudi
Level 2
March 28, 2022
Solved

How to get localized tag tile in htl

  • March 28, 2022
  • 1 reply
  • 1078 views

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?

HTL

<ul>
<li data-sly-repeat.tag="${relatedTags.iterator}">
${tag.title}
// get localized title
</li>
</ul>
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by lukasz-m

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>

1 reply

lukasz-m
Community Advisor
lukasz-mCommunity AdvisorAccepted solution
Community Advisor
March 28, 2022

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>
bpeddapudi
Level 2
March 28, 2022

Thanks Lukasz I will move the code to the model