Toggle Link to switch from one language to another

Amy Patterson asked on March 9, 2022 15:50

What is the best method to add a culture switch to our live url pages? Currently we came up with using a replace method in our macro, Do you have some macro's that you could share of a better way?

Our current way code in the Master Page layout:

     <a href="{%CurrentDocument.AbsoluteURL.Replace("es-es","en-us")%}" aria-label="Language">
English</a>

<a href="{%CurrentDocument.AbsoluteURL.Replace("en-us","es-es")%}" aria-label="Language">
Español</a>

Recent Answers


vasu yerramsetti answered on March 10, 2022 05:18 (last edited on March 10, 2022 05:31)

You can use the following web parts from Portal Engine (out of the box)-

  • LanguageDataSource
  • LanguageSelector with transformation(Text/XML) - <a href="{%HTMLEncode(URL)%}"> {% HTMLEncode(CultureName) %} ({% HTMLEncode(CultureCode) %}) </a>
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.