summaryrefslogtreecommitdiff
path: root/help3xsl/online_transform.xsl
diff options
context:
space:
mode:
authorOlivier Hallot <olivier.hallot@libreoffice.org>2018-05-20 09:43:01 -0300
committerJan Holesovsky <kendy@collabora.com>2018-08-07 17:55:29 +0200
commitdc18c0b4b8889a4189810a2849c7de2a79e492d6 (patch)
tree8b29c80f46b42a1405ba898b395595c903b00625 /help3xsl/online_transform.xsl
parent4701239dbcb9b1add8d6186cb6ddc45105cbe08a (diff)
Add support for localized collateral files
Fix src Change-Id: I4997884f087b625c8ac8dbf923363d97f88f7922 Reviewed-on: https://gerrit.libreoffice.org/54599 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org>
Diffstat (limited to 'help3xsl/online_transform.xsl')
-rw-r--r--help3xsl/online_transform.xsl76
1 files changed, 70 insertions, 6 deletions
diff --git a/help3xsl/online_transform.xsl b/help3xsl/online_transform.xsl
index 1639e3495a..5e00661fb8 100644
--- a/help3xsl/online_transform.xsl
+++ b/help3xsl/online_transform.xsl
@@ -1125,39 +1125,69 @@
</div>
</xsl:when>
<xsl:when test="@type='application/vnd.oasis.opendocument.spreadsheet'">
+ <xsl:variable name="src">
+ <xsl:call-template name="addlang2path">
+ <xsl:with-param name="string" select="@data"/>
+ </xsl:call-template>
+ </xsl:variable>
<div class="samplefilesection">
<h3><xsl:apply-templates select="$tmp_doc//variable[@id='samplefile']"/></h3>
- <a class="objectfiles" href="{concat($target,@data)}"><img src="{concat($target,'media/navigation/libo-calc.svg')}" width="25px" height="30px"></img></a>
+ <a class="objectfiles" href="{concat($target,$src)}"><img src="{concat($target,'media/navigation/libo-calc.svg')}" width="25px" height="30px"></img></a>
</div>
</xsl:when>
<xsl:when test="@type='application/vnd.oasis.opendocument.text'">
+ <xsl:variable name="src">
+ <xsl:call-template name="addlang2path">
+ <xsl:with-param name="string" select="@data"/>
+ </xsl:call-template>
+ </xsl:variable>
<div class="samplefilesection">
<h3><xsl:apply-templates select="$tmp_doc//variable[@id='samplefile']"/></h3>
- <a class="objectfiles" href="{concat($target,@data)}"><img src="{concat($target,'media/navigation/libo-writer.svg')}" width="25px" height="30px"></img></a>
+ <a class="objectfiles" href="{concat($target,$src)}"><img src="{concat($target,'media/navigation/libo-writer.svg')}" width="25px" height="30px"></img></a>
</div>
</xsl:when>
<xsl:when test="@type='application/vnd.oasis.opendocument.presentation'">
+ <xsl:variable name="src">
+ <xsl:call-template name="addlang2path">
+ <xsl:with-param name="string" select="@data"/>
+ </xsl:call-template>
+ </xsl:variable>
<div class="samplefilesection">
<h3><xsl:apply-templates select="$tmp_doc//variable[@id='samplefile']"/></h3>
- <a class="objectfiles" href="{concat($target,@data)}"><img src="{concat($target,'media/navigation/libo-impress.svg')}" width="25px" height="30px"></img></a>
+ <a class="objectfiles" href="{concat($target,$src)}"><img src="{concat($target,'media/navigation/libo-impress.svg')}" width="25px" height="30px"></img></a>
</div>
</xsl:when>
<xsl:when test="@type='application/vnd.oasis.opendocument.drawing'">
+ <xsl:variable name="src">
+ <xsl:call-template name="addlang2path">
+ <xsl:with-param name="string" select="@data"/>
+ </xsl:call-template>
+ </xsl:variable>
<div class="samplefilesection">
<h3><xsl:apply-templates select="$tmp_doc//variable[@id='samplefile']"/></h3>
- <a class="objectfiles" href="{concat($target,@data)}"><img src="{concat($target,'media/navigation/libo-draw.svg')}" width="25px" height="30px"></img></a>
+ <a class="objectfiles" href="{concat($target,$src)}"><img src="{concat($target,'media/navigation/libo-draw.svg')}" width="25px" height="30px"></img></a>
</div>
</xsl:when>
<xsl:when test="@type='application/vnd.oasis.opendocument.formula'">
+ <xsl:variable name="src">
+ <xsl:call-template name="addlang2path">
+ <xsl:with-param name="string" select="@data"/>
+ </xsl:call-template>
+ </xsl:variable>
<div class="samplefilesection">
<h3><xsl:apply-templates select="$tmp_doc//variable[@id='samplefile']"/></h3>
- <a class="objectfiles" href="{concat($target,@data)}"><img src="{concat($target,'media/navigation/libo-math.svg')}" width="25px" height="30px"></img></a>
+ <a class="objectfiles" href="{concat($target,$src)}"><img src="{concat($target,'media/navigation/libo-math.svg')}" width="25px" height="30px"></img></a>
</div>
</xsl:when>
<xsl:when test="@type='application/vnd.oasis.opendocument.database'">
+ <xsl:variable name="src">
+ <xsl:call-template name="addlang2path">
+ <xsl:with-param name="string" select="@data"/>
+ </xsl:call-template>
+ </xsl:variable>
<div class="samplefilesection">
<h3><xsl:apply-templates select="$tmp_doc//variable[@id='samplefile']"/></h3>
- <a class="objectfiles" href="{concat($target,@data)}"><img src="{concat($target,'media/navigation/libo-base.svg')}" width="25px" height="30px"></img></a>
+ <a class="objectfiles" href="{concat($target,$src)}"><img src="{concat($target,'media/navigation/libo-base.svg')}" width="25px" height="30px"></img></a>
</div>
</xsl:when>
<xsl:otherwise>
@@ -1293,4 +1323,38 @@
</xsl:otherwise>
</xsl:choose>
</xsl:template>
+<!--Add language to path for file -->
+<xsl:template name="addlang2path">
+ <xsl:param name="string"/>
+ <xsl:choose>
+ <xsl:when test="not($lang='en-US')">
+ <xsl:variable name="tmpfn">
+ <xsl:call-template name="substring-after-last">
+ <xsl:with-param name="string" select="$string"/>
+ <xsl:with-param name="char" select="'/'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat(substring-before($string, $tmpfn),$lang,'/',$tmpfn)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($target,$string)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template name="substring-after-last">
+ <xsl:param name="string"/>
+ <xsl:param name="char"/>
+ <xsl:choose>
+ <xsl:when test="contains($string, $char)">
+ <xsl:call-template name="substring-after-last">
+ <xsl:with-param name="string" select="substring-after($string, $char)"/>
+ <xsl:with-param name="char" select="$char"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
</xsl:stylesheet>