How To implement automatic links to Translated versions of a Content Item

Tue Oct 13, 2015

The following steps can be used to setup automated links to other localized versions of a content item:

  1. Update Folder Content relationship Deep Cloning rule to point to “Translation” relationship
  2. Create a snippet template that is used to render the other localized version of the content
  3. Create a “sys_TranslationContentFinder” slot and associate the snippet template created in step 2
  4. Update the page/global template where the other localized content link need to be rendered in published page.

Step 1 – Update FolderContent relationship rule:

Update the Folder Content relationship’s Deep cloning condition rule to link to the Translation relationship as shown in below screenshot.

Translate

Step 2 – Create a snippet template(Named - translationSnippet) that renders the link of the other localized content. Sample source code where there are two locales(French and English) in the system that need to be linked.

<ahref="$pagelink"

#if( $lang=="fr-ca")##

<span>French &nbsp;</span></a>

#else##

<span>English &nbsp;</span></a>

#end##

Where the $lang and $pagelink bindings are as follows:

$lang = $sys.item.getProperty("sys_lang").String
$pagelink = $rx.location.generate($sys.assemblyItem)

 

Step 3: Create a sys_TranslationContentFinder slot(Name – TranslatedItemContentFinder) associating the template created in step 2. Sample slot configuration given below.

Translate

 

Step 4: Update global template to include the sys_TranslatiionContentFinder slot. Sample code snippet

#initslot("TranslatedItemContentFinder""")##

$sys.currentslot.relresults.size()

#if($sys.currentslot.relresults.size() > 0)##

#foreach( $relresultin $sys.currentslot.relresults)##

#slotItem($relresult)##

#end##

#end##

#endslot("TranslatedItemContentFinder")##

Mythili Kulamavalavan Headshot
Mythili Kulamavalavan
Senior Technical Consultant | Percussion Software

N/A

comments powered by Disqus