summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Hallot <olivier.hallot@libreoffice.org>2018-05-20 09:43:01 -0300
committerOlivier Hallot <olivier.hallot@libreoffice.org>2018-05-21 00:32:24 +0200
commita9cecd08312f8115c657a640a05bb91f21248f0a (patch)
treeee176b9e2b2b1ca32cd32b57b05c7f67f14d190a
parent4efd1d34c0c0575f167e06589f24f8bd255c49ba (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>
-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 1e59921ec9..9839891ba9 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>