the site: http://www.sika-footwear.dk/Default.aspx?ID=1 ( right-side search function)
the template: Templates/eCom/Product/sika_2010_ProductAdvanced.xslt
the problem...
Im trying to implement translation in the above mentioned template, and are commin up short on how to do this.
I have read the below mentioned post, that concerns page-templates which have given me some answers. But the Translations.xml file that is located in the root of the eComm folder is empty.. How do I fill in information in this? Is this done in the XSLT template, or is it done by hand first, and then implemented using the code, shown in the below thread? Does anyone have an example file/code that I can check out?
http://engage.dynamicweb-cms.com/Forum-5.aspx?action=ShowThread&ThreadID=2126
Developer forum
E-mail notifications
eComm XSLT-tempalte translation
Posted on 11/11/2010 10:20:39
Replies
Nicolai Høeg Pedersen
Posted on 11/11/2010 11:56:19
To see how to do the actual translations have a look at the "(en-US) Working with template terminologies.pdf " from here: http://engage.dynamicweb-cms.com/Working-with-183.aspx
Posted on 11/11/2010 11:59:54
Thanks for the reply.
This pdf is great, but the code examples unfortunally only concerns html markup, and not XSLT, which is the problem im having. How do I use the @Translate() notation in XSLT? I have been trying to find information about this, so far without success.
This pdf is great, but the code examples unfortunally only concerns html markup, and not XSLT, which is the problem im having. How do I use the @Translate() notation in XSLT? I have been trying to find information about this, so far without success.
Nicolai Høeg Pedersen
Posted on 11/11/2010 12:50:26
How to do it in XSLT is what is described in the thread you posted...
Posted on 11/11/2010 13:26:24
yes, I have tried to follow the directions from that site, and keep getting a xslt error, referring to the name used in the code, used to call the template. It says that the name of the template "translate" is unknown..
Can you please take a look at my template, and see whats Im doing wrong?
Can you please take a look at my template, and see whats Im doing wrong?
Posted on 12/11/2010 13:12:03
Hi,
You are missing the translate template which is called each time you need a translation (See the last part of this post)...
Important! If you need to call one translation more than once in your template, you need to make a template for that translation (If anyone knows a better way, please post it here, but this works for me):
Place this each place you need the translation: <xsl:call-template name="ReadMoreAbout" />
Place this just above the template I've included in the bottom of the post:
<xsl:template name="ReadMoreAbout">
<xsl:call-template name="translate">
<xsl:with-param name="translationkey" select="'readMoreTitle'" />
<xsl:with-param name="defaulttranslation" select="'Læs mere om '" />
</xsl:call-template>
</xsl:template>
Place this in the bottom of your file:
<!-- The Magic Translation part -->
<xsl:template name="translate">
<xsl:param name="translationkey" />
<xsl:param name="defaulttranslation" />
<xsl:variable name="currentlanguage" select="/Template/GlobalTags/Global.Area.LongLang" />
<!-- here i find the translation needed in the document that we loaded in line 4 -->
<xsl:variable name="translation" select="$translate/translations/key[@name=$translationkey]/translation[@culture=$currentlanguage]" />
<xsl:choose>
<xsl:when test="string-length($translation) != 0">
<xsl:value-of select="$translation" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$defaulttranslation" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
You are missing the translate template which is called each time you need a translation (See the last part of this post)...
Important! If you need to call one translation more than once in your template, you need to make a template for that translation (If anyone knows a better way, please post it here, but this works for me):
Place this each place you need the translation: <xsl:call-template name="ReadMoreAbout" />
Place this just above the template I've included in the bottom of the post:
<xsl:template name="ReadMoreAbout">
<xsl:call-template name="translate">
<xsl:with-param name="translationkey" select="'readMoreTitle'" />
<xsl:with-param name="defaulttranslation" select="'Læs mere om '" />
</xsl:call-template>
</xsl:template>
Place this in the bottom of your file:
<!-- The Magic Translation part -->
<xsl:template name="translate">
<xsl:param name="translationkey" />
<xsl:param name="defaulttranslation" />
<xsl:variable name="currentlanguage" select="/Template/GlobalTags/Global.Area.LongLang" />
<!-- here i find the translation needed in the document that we loaded in line 4 -->
<xsl:variable name="translation" select="$translate/translations/key[@name=$translationkey]/translation[@culture=$currentlanguage]" />
<xsl:choose>
<xsl:when test="string-length($translation) != 0">
<xsl:value-of select="$translation" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$defaulttranslation" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Posted on 12/11/2010 14:14:27
That did it! Thanks for your help, all of you :)
Posted on 29/11/2010 13:43:49
Hi Jensen,
I actually use xslt variables instead of templates for all my translations. Found it easier to apply with either {} or xsl:value-of select="".
I don't have any info regading performance though. Would be great if someone did and cared to share :)
nuno
I actually use xslt variables instead of templates for all my translations. Found it easier to apply with either {} or xsl:value-of select="".
I don't have any info regading performance though. Would be great if someone did and cared to share :)
nuno
You must be logged in to post in the forum