Skip to content

Commit

Permalink
du traduk-eroj se aperas ene <pr>
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfram Diestel committed Sep 12, 2023
1 parent 8f2478d commit c0c1540
Showing 1 changed file with 68 additions and 22 deletions.
90 changes: 68 additions & 22 deletions xsl/revo_json.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -254,23 +254,7 @@ aperi kiel ref@cel, t.e. referencitaj de iu ajn artikolo
<xsl:value-of select="$lng"/>
<xsl:text>","</xsl:text>
<!-- la indeksenda kapvorto: ni devas ekskluzive distingi inter ind, mll kaj text...-->
<xsl:choose>
<xsl:when test="ind">
<xsl:call-template name="normalize">
<xsl:with-param name="str" select="ind"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="mll">
<xsl:call-template name="normalize">
<xsl:with-param name="str" select="mll"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="normalize">
<xsl:with-param name="str" select="text()"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="trd-ind"/>
<!-- ni aldonas trd nur se ĝi enhavas klr, ind aŭ mll kaj do distingiĝas de la kapvorto -->
<xsl:text>","</xsl:text>
<!-- la traduko inkl. klr..., sed sen ofc -->
Expand Down Expand Up @@ -298,24 +282,66 @@ aperi kiel ref@cel, t.e. referencitaj de iu ajn artikolo
</xsl:if>
</xsl:template>

<!-- ĉe tradukoj kun prononco/transskribo ni ankaŭ kreas liston por
<!-- ĉe tradukoj kun prononco/transskribo ni kreas du listojn por
tiu transskribo, tiel ke ni povas serĉi aŭ je la traduko mem aŭ je la transskribo -->
<xsl:template match="trd[pr]">
<xsl:variable name="lng" select="ancestor-or-self::*[@lng][1]/@lng"/>
<xsl:variable name="mrk">
<xsl:apply-templates select="ancestor::*[@mrk][1]/@mrk"/>
</xsl:variable>

<!-- ero por serĉi laŭ la origina skribo -->
<xsl:text>["</xsl:text>
<xsl:value-of select="$mrk"/>
<xsl:text>","</xsl:text>
<xsl:value-of select="$lng"/>
<xsl:text>","</xsl:text>
<!-- la indeksenda kapvorto: ni devas ekskluzive distingi inter ind, mll kaj text...-->
<xsl:call-template name="trd-ind"/>
<!-- ni aldonas trd nur se ĝi enhavas klr, ind aŭ mll kaj do distingiĝas de la kapvorto -->
<xsl:text>","</xsl:text>
<!-- la traduko inkl. klr..., sed sen ofc -->
<xsl:choose>
<xsl:when test="mll">
<xsl:apply-templates select="mll"/>
</xsl:when>
<xsl:when test="ind|klr">
<xsl:call-template name="trd-join"/>
</xsl:when>
<!--xsl:otherwise>
<xsl:text></xsl:text>
</xsl:otherwise-->
</xsl:choose>
<!-- se temas pri traduko en ekzemplo aŭ bildo ni aldonu la ind-parton de la ekz-o -->
<xsl:if test="ancestor::bld|ancestor::ekz">
<xsl:text>","</xsl:text>
<xsl:apply-templates select="(ancestor::bld|ancestor::ekz)/ind"/>
</xsl:if>

<xsl:apply-templates select="ancestor::*[@mrk][1]/@mrk"/>
<xsl:text>"],</xsl:text>

<!-- ero por serĉi laŭ la prononco -->
<xsl:text>["</xsl:text>
<xsl:value-of select="$mrk"/>
<xsl:text>","</xsl:text>
<xsl:value-of select="$lng"/>
<xsl:text>","</xsl:text>
<xsl:call-template name="normalize">
<xsl:with-param name="str" select="pr"/>
</xsl:call-template>
<xsl:text>","</xsl:text>
<!-- la traduko inkl. klr..., sed sen pr, ofc -->
<xsl:call-template name="trd-join"/>
<!-- la traduko inkl. klr..., sed sen ofc -->
<xsl:choose>
<xsl:when test="mll">
<xsl:apply-templates select="mll"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="trd-join"/>
</xsl:otherwise>
</xsl:choose>
<!-- se temas pri traduko en ekzemplo aŭ bildo ni aldonu la ind-parton de la ekz-o -->
<!-- por tradukoj kun <pr> ni provizore esceptas bld/ekz
<!-- por tradukoj kun <pr> ni ne metas bld/ekz en la duan eron
por eviti duoblaĵojn en la serĉo je ekzemploj
<xsl:if test="ancestor::bld|ancestor::ekz">
<xsl:text>","</xsl:text>
<xsl:apply-templates select="(ancestor::bld|ancestor::ekz)/ind"/>
Expand All @@ -328,6 +354,26 @@ aperi kiel ref@cel, t.e. referencitaj de iu ajn artikolo
</xsl:if>
</xsl:template>

<xsl:template name="trd-ind">
<xsl:choose>
<xsl:when test="ind">
<xsl:call-template name="normalize">
<xsl:with-param name="str" select="ind"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="mll">
<xsl:call-template name="normalize">
<xsl:with-param name="str" select="mll"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="normalize">
<xsl:with-param name="str" select="text()"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template name="trd-join">
<!-- kuni ĉion al signoĉeno kaj poste normigi spacojn en XSL 1.0 estas iom malsimpla... -->
<xsl:call-template name="normalize">
Expand Down

0 comments on commit c0c1540

Please sign in to comment.