Add language parameter to links

git-svn-id: https://svn.libreccm.org/ccm/trunk@4897 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2017-08-07 12:59:26 +00:00
parent 0f6b5c3c8d
commit 4ae670f033
5 changed files with 59 additions and 4 deletions

View File

@ -991,7 +991,14 @@
<xsl:function name="foundry:generate-contentitem-link"> <xsl:function name="foundry:generate-contentitem-link">
<xsl:param name="oid"/> <xsl:param name="oid"/>
<xsl:sequence select="concat($context-prefix, '/redirect/?oid=', $oid)"/> <xsl:choose>
<xsl:when test="foundry:get-setting('appendLanguageParameter', '') = 'true'">
<xsl:sequence select="concat($context-prefix, '/redirect/?oid=', $oid, '&amp;lang=', $negotiated-language)"/>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="concat($context-prefix, '/redirect/?oid=', $oid)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:function> </xsl:function>

View File

@ -123,6 +123,9 @@
'/redirect/?oid=', '/redirect/?oid=',
./targetItem/@oid, ./targetItem/@oid,
$params)"/> $params)"/>
<xsl:with-param name="append-language-parameter"
tunnel="yes"
select="'true'"/>
<xsl:with-param name="target-item-title" <xsl:with-param name="target-item-title"
tunnel="yes" tunnel="yes"
select="./targetItem/title"/> select="./targetItem/title"/>

View File

@ -359,6 +359,9 @@
./formatKey, ./formatKey,
'&amp;publication=', '&amp;publication=',
./publicationId)"/> ./publicationId)"/>
<xsl:with-param name="append-language-parameter"
tunnel="yes"
select="'true'" />
<xsl:with-param name="export-formatkey" <xsl:with-param name="export-formatkey"
tunnel="yes" tunnel="yes"
select="./formatKey"/> select="./formatKey"/>

View File

@ -143,7 +143,8 @@
<xsl:param name="href" select="''" tunnel="yes"/> <xsl:param name="href" select="''" tunnel="yes"/>
<xsl:param name="hreflang" select="''" tunnel="yes"/> <xsl:param name="hreflang" select="''" tunnel="yes"/>
<xsl:param name="title" select="''" tunnel="yes"/> <xsl:param name="title" select="''" tunnel="yes"/>
<xsl:param name="type" select="''" tunnel="yes"/> <xsl:param name="type" select="''" tunnel="yes"
<xsl:param name="append-language-parameter" select='false'/>
<a> <a>
<xsl:if test="./@href-property"> <xsl:if test="./@href-property">
@ -165,7 +166,21 @@
</xsl:if> </xsl:if>
<xsl:if test="$href != ''"> <xsl:if test="$href != ''">
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="$href"/> <xsl:choose>
<xsl:when test="$append-language-parameter = 'true' and foundry:get-setting('append-language-parameter', '') = 'true'">
<xsl:choose>
<xsl:when test="contains($href, '?')">
<xsl:value-of select="concat($href, &lang=', $negotiated-language)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($href, '?lang=', $negotiated-language)" />
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$href"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute> </xsl:attribute>
</xsl:if> </xsl:if>
<xsl:if test="string-length($hreflang) &gt; 0"> <xsl:if test="string-length($hreflang) &gt; 0">

View File

@ -80,6 +80,9 @@
<xsl:with-param name="breadcrumb-label" <xsl:with-param name="breadcrumb-label"
tunnel="yes" tunnel="yes"
select="foundry:get-static-text('breadcrumbs', 'root')"/> select="foundry:get-static-text('breadcrumbs', 'root')"/>
<xsl:with-param name="append-language-parameter"
tunnel="yes"
select="'true'" />
</xsl:apply-templates> </xsl:apply-templates>
<xsl:if test="count($data-tree//nav:categoryPath/nav:category) &gt; 1"> <xsl:if test="count($data-tree//nav:categoryPath/nav:category) &gt; 1">
<xsl:copy-of select="$breadcrumb-separator/*"/> <xsl:copy-of select="$breadcrumb-separator/*"/>
@ -99,6 +102,9 @@
</xsl:choose> </xsl:choose>
</xsl:with-param> </xsl:with-param>
<xsl:with-param name="breadcrumb-label" tunnel="yes" select="./@title"/> <xsl:with-param name="breadcrumb-label" tunnel="yes" select="./@title"/>
<xsl:with-param name="append-language-parameter"
tunnel="yes"
select="'true'" />
</xsl:apply-templates> </xsl:apply-templates>
<xsl:if test="position() != last()"> <xsl:if test="position() != last()">
<xsl:copy-of select="$breadcrumb-separator/*"/> <xsl:copy-of select="$breadcrumb-separator/*"/>
@ -148,6 +154,9 @@
<xsl:with-param name="href" <xsl:with-param name="href"
tunnel="yes" tunnel="yes"
select="$data-tree//nav:categoryPath/nav:category[position() = 2]/@url"/> select="$data-tree//nav:categoryPath/nav:category[position() = 2]/@url"/>
<xsl:with-param name="append-language-parameter"
tunnel="yes"
select="'true'" />
</xsl:apply-templates> </xsl:apply-templates>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
@ -156,6 +165,9 @@
<xsl:with-param name="href" <xsl:with-param name="href"
tunnel="yes" tunnel="yes"
select="$data-tree//nav:categoryPath/nav:category[position() = 1]/@url"/> select="$data-tree//nav:categoryPath/nav:category[position() = 1]/@url"/>
<xsl:with-param name="append-language-parameter"
tunnel="yes"
select="'true'" />
</xsl:apply-templates> </xsl:apply-templates>
</xsl:if> </xsl:if>
</xsl:otherwise> </xsl:otherwise>
@ -198,7 +210,7 @@
select="$data-tree//nav:categoryMenu[@id=$navigation-id]/nav:category/@url" select="$data-tree//nav:categoryMenu[@id=$navigation-id]/nav:category/@url"
tunnel="yes"/>--> tunnel="yes"/>-->
<xsl:with-param name="href" <xsl:with-param name="href"
tunnel="yes"> tunnel="yes">
<xsl:choose> <xsl:choose>
<xsl:when test="$data-tree//nav:categoryMenu[@id=$navigation-id]/nav:category/@url"> <xsl:when test="$data-tree//nav:categoryMenu[@id=$navigation-id]/nav:category/@url">
<xsl:value-of select="$data-tree//nav:categoryMenu[@id=$navigation-id]/nav:category/@url"/> <xsl:value-of select="$data-tree//nav:categoryMenu[@id=$navigation-id]/nav:category/@url"/>
@ -208,6 +220,9 @@
</xsl:when> </xsl:when>
</xsl:choose> </xsl:choose>
</xsl:with-param> </xsl:with-param>
<xsl:with-param name="append-language-parameter"
tunnel="yes"
select="'true'" />
<xsl:with-param name="navigation-id" select="$navigation-id" tunnel="yes"/> <xsl:with-param name="navigation-id" select="$navigation-id" tunnel="yes"/>
<xsl:with-param name="title" tunnel="yes"> <xsl:with-param name="title" tunnel="yes">
<xsl:choose> <xsl:choose>
@ -450,6 +465,9 @@
select="$navigation-links-tree" select="$navigation-links-tree"
tunnel="yes"/> tunnel="yes"/>
<xsl:with-param name="href" select="./@url" tunnel="yes"/> <xsl:with-param name="href" select="./@url" tunnel="yes"/>
<xsl:with-param name="append-language-parameter"
tunnel="yes"
select="'true'"/>
<xsl:with-param name="title" tunnel="yes"> <xsl:with-param name="title" tunnel="yes">
<xsl:choose> <xsl:choose>
<xsl:when test="$show-description-text and ./@description"> <xsl:when test="$show-description-text and ./@description">
@ -490,6 +508,9 @@
select="$navigation-links-tree" select="$navigation-links-tree"
tunnel="yes"/> tunnel="yes"/>
<xsl:with-param name="href" select="./@url" tunnel="yes"/> <xsl:with-param name="href" select="./@url" tunnel="yes"/>
<xsl:with-param name="append-language-parameter"
tunnel="yes"
select="'true'" />
<xsl:with-param name="title" tunnel="yes"> <xsl:with-param name="title" tunnel="yes">
<xsl:choose> <xsl:choose>
<xsl:when test="$show-description-text and ./@description"> <xsl:when test="$show-description-text and ./@description">
@ -573,6 +594,9 @@
<xsl:with-param name="href" <xsl:with-param name="href"
tunnel="yes" tunnel="yes"
select="./nav:url"/> select="./nav:url"/>
<xsl:with-param name="append-language-parameter"
tunnel="yes"
select="'true'"/>
<xsl:with-param name="quicklink-description" <xsl:with-param name="quicklink-description"
tunnel="yes" tunnel="yes"
select="./nav:description"/> select="./nav:description"/>
@ -674,6 +698,9 @@
select="$navigation-links-tree" select="$navigation-links-tree"
tunnel="yes"/> tunnel="yes"/>
<xsl:with-param name="href" select="./@url" tunnel="yes"/> <xsl:with-param name="href" select="./@url" tunnel="yes"/>
<xsl:with-param name="append-language-parameter"
tunnel="yes"
select="'true'" />
<xsl:with-param name="title" tunnel="yes"> <xsl:with-param name="title" tunnel="yes">
<xsl:choose> <xsl:choose>
<xsl:when test="$show-description-text and ./@description"> <xsl:when test="$show-description-text and ./@description">