Sharing video files based on your language - sitecore

I am learning sitecore.

I would like to make a flash video, which should change between the two languages ​​depending on the chosen language.

Example: If I choose English, I have to make an English version of the video, and if the French language is selected, the French version of the video should be rendering. I have both versions of flash files.

How can I achieve this with xslt or JS? Any help is appreciated.

Thanks in advance.

+4
source share
2 answers

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

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 :)

+1
source

Instead, using code would be a better solution to pull a link to your flash file from a field in an element in Sitecore. This can be either on the current element of the page that the user is viewing, or if you need it through the site, and then on the element that your subtask refers to, which displays Flash video.

Thus, your code remains simple, and if you need to switch to other languages, you do not need to change your code; you just need to create a new translation of the element that points to another flash file.

+1
source

Source: https://habr.com/ru/post/1386330/


All Articles