Hi Nigel! The only problem I see is that @Html.Raw(@translatedTitle) should be @Html.Raw(translatedTitle) When sending output using Razor like that, you only need to use the @ sign once, in the beginning of the first method or variable, not for each one used as a parameter. Let me know if this works for you, or if you need more help! Best regards, Dimitri
If you are using Polyglot with an Umbraco version equal to or higher than 4.7.1, have you applied the razor script patch? It is necessary for the razor version of the package. Please see here: http://polyglot.codeplex.com/releases/view/108426
Let me know if this resolves the problem. If you are still encountering difficulties, I will run some tests. I was on holiday and I did not have my development environment with me, but I am back now :)
This is just a note for whomever is reading this conversation. Things have recently changed. A razor script patch is now required for Umbraco versions 4.7.0 or earlier. The razor script version of the Polyglot package is now built to work properly with the latest versions of Umbraco by default and not the other way around.
Examples for use in Razor
I wonder if you could post an example for use on a razor .cshtml page.
I've tried to copy the code within TranslateNavigation.cshtml but haven't got very far.
It very simple in xslt but I'm new to razor
@{
string selectedLanguage = RenderPage("~/macroScripts/SelectedLanguage.cshtml").ToString().Trim();
string translatedTitle = RenderPage("~/macroScripts/PropertyReferenceTranslation.cshtml", Model.Content.Id, "'bodyText", selectedLanguage).ToString();
@Html.Raw(@translatedTitle)
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library"
xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes"
xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions"
xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="currentPage" />
<xsl:include href="../xslt/LanguageParameter.xslt" />
<xsl:include href="../xslt/PropertyReferenceTranslation.xslt" />
<xsl:template match="/">
<xsl:call-template name="PropertyReferenceTranslation">
<xsl:with-param name="nodeId" select="$currentPage/@id" />
<xsl:with-param name="Property" select="'bodyText'" />
<xsl:with-param name="langISO" select="$langISO" />
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>
Hi Nigel! The only problem I see is that @Html.Raw(@translatedTitle) should be @Html.Raw(translatedTitle) When sending output using Razor like that, you only need to use the @ sign once, in the beginning of the first method or variable, not for each one used as a parameter. Let me know if this works for you, or if you need more help! Best regards, Dimitri
Thanks Dimitri
No joy with @Html.Raw(translatedTitle) - I've also tried
@Umbraco.RenderMacro("PropertyReferenceTranslation", new {nodeId = Model.Content.Id, Property = "bodyText", langISO = selectedLanguage})
but it always returns : umbraco.MacroEngines.PropertyResult
For the record
@Umbraco.RenderMacro("PropertyTranslation", new {Property = "bodyText"})
does work and so does
@Umbraco.RenderMacro("PropertyReferenceTranslation", new {nodeId = Model.Content.Id, Property = "bodyText", langISO = selectedLanguage})
if I add the following to the xslt file' PropertyReferenceTranslation.xslt'
<xsl:param name="nodeId" select="macro/nodeId" />
<xsl:param name="Property" select="macro/Property"/>
<xsl:param name="langISO" select="macro/langISO"/>
Hi Nigel,
If you are using Polyglot with an Umbraco version equal to or higher than 4.7.1, have you applied the razor script patch? It is necessary for the razor version of the package. Please see here: http://polyglot.codeplex.com/releases/view/108426
Let me know if this resolves the problem. If you are still encountering difficulties, I will run some tests. I was on holiday and I did not have my development environment with me, but I am back now :)
Best regards,
Dimitri
Hi everyone!
This is just a note for whomever is reading this conversation. Things have recently changed. A razor script patch is now required for Umbraco versions 4.7.0 or earlier. The razor script version of the Polyglot package is now built to work properly with the latest versions of Umbraco by default and not the other way around.
Best regards,
Dimitri
is working on a reply...