Frage

I'm learning sitecore.

I would like to render flash video which should swap between two languages depending the current language selected.

Ex: If I select English, I should render english version of the video and if French selected, french version of the video should render.I have both versions of the flash files.

How can i achieve this using xslt or JS? Any help is appreciated.

Thanks in advance.

War es hilfreich?

Lösung

You can use the xslt helper function sc:language() to get the current language of the page.

A rough example :

<xsl:choose>
  <xsl:when test="sc:language() = 'en'">
   [SHOW FLASH for EN]
  </xsl:when>
  <xsl:otherwise>
    [SHOW DEFAULT FLASH]
  </xsl:otherwise>
</xsl:choose>

Hope this helps :)

Andere Tipps

Rather than achieve this through code, it would be a better solution to pull out a reference to your flash file from a Field in an Item in Sitecore. This could either be on the the current Item of the page the user is viewing, or if you need this across the site then on an Item referenced by your sublayout which displays the Flash video.

That way your code remains simple, and if you need to extend to other languages, you don't have to change your code; you just need to create a new translation of the item which points to a different flash file.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top