How to get localized tag tile in htl | Community
Skip to main content
bpeddapudi
Level 2
Mar 28, 2022 6:42 PM UTC
Solved

How to get localized tag tile in htl

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.
lukasz-m
lukasz-mAccepted solution
New Participant
Mar 28, 2022 9:22 PM UTC

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>

2 replies

lukasz-m
lukasz-mAccepted solution
New Participant
Mar 28, 2022 9:22 PM UTC

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>
Translate
bpeddapudi
Level 2
Mar 28, 2022 9:28 PM UTC

Thanks Lukasz I will move the code to the model

Translate