Skip to content

Commit

Permalink
Define translations and fix a quoting problem
Browse files Browse the repository at this point in the history
  • Loading branch information
egli committed Nov 3, 2021
1 parent ecce267 commit 38b294a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
doctype-public="-//NISO//DTD dtbook 2005-3//EN"
doctype-system="http://www.daisy.org/z3986/2005/dtbook-2005-3.dtd" />

<xsl:variable name="translations" select="document('../i18n/translations.xml')/*"/>

<xsl:template name="boilerplate">
<xsl:variable name="language" select="('de',ancestor-or-self::*[@xml:lang|@lang]/(@xml:lang|@lang)[1])[last()]"/>
<xsl:variable name="about-book" select="pf:i18n-translate('about-book',$language,$translations)"/>
<xsl:variable name="copyright-text" select="pf:i18n-translate('copyright-text,$language,$translations)"/>
<xsl:variable name="copyright-text" select="pf:i18n-translate('copyright-text',$language,$translations)"/>
<xsl:variable name="electronic-data-thanks" select="pf:i18n-translate('electronic-data-thanks',$language,$translations)"/>
<xsl:variable name="producer" select="pf:i18n-translate('producer',$language,$translations)"/>
<xsl:variable name="producer-brief" select="pf:i18n-translate('producer-brief',$language,$translations)"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<!-- Add an empty header to the first level1 w/o h1 in the frontmatter -->
<xsl:template match="dtb:frontmatter//dtb:level1[@class='titlepage'][1][not(dtb:h1)]">
<xsl:variable name="language" select="('de',ancestor-or-self::*[@xml:lang|@lang]/(@xml:lang|@lang)[1])[last()]"/>
<xsl:variable name="blurb" select="pf:i18n-translate('Bibliographische Angaben',$language,$translations)"/>
<xsl:variable name="blurb" select="pf:i18n-translate('Bibliographische Angaben', $language, $translations)"/>
<xsl:apply-templates select="." mode="addHeading">
<xsl:with-param name="level" select="1"/>
<xsl:with-param name="blurb" select="$blurb"/>
Expand All @@ -46,7 +46,7 @@
<!-- Add an empty header to all level1 w/o h1 in the frontmatter -->
<xsl:template match="dtb:frontmatter//dtb:level1[not(dtb:h1)][not(@class='titlepage')]">
<xsl:variable name="language" select="('de',ancestor-or-self::*[@xml:lang|@lang]/(@xml:lang|@lang)[1])[last()]"/>
<xsl:variable name="blurb" select="pf:i18n-translate('header',$language,$translations)"/>
<xsl:variable name="blurb" select="pf:i18n-translate('header', $language, $translations)"/>
<xsl:variable name="total" select="count(../dtb:level1[not(dtb:h1)][not(@class='titlepage')])"/>
<xsl:variable name="pos" select="count(preceding-sibling::dtb:level1[not(dtb:h1)][not(@class='titlepage')])+1"/>
<xsl:variable name="title" select="if ($total &gt; 1) then concat($blurb,' ', $pos) else $blurb"/>
Expand All @@ -66,7 +66,7 @@
<!-- Add an empty header to all level1 w/o h1 in the rearmatter -->
<xsl:template match="dtb:rearmatter//dtb:level1[not(dtb:h1)]">
<xsl:variable name="language" select="('de',ancestor-or-self::*[@xml:lang|@lang]/(@xml:lang|@lang)[1])[last()]"/>
<xsl:variable name="blurb" select="pf:i18n-translate('trailer',$language,$translations)"/>
<xsl:variable name="blurb" select="pf:i18n-translate('trailer', $language, $translations)"/>
<xsl:variable name="total" select="count(../dtb:level1[not(dtb:h1)])"/>
<xsl:variable name="pos" select="count(preceding-sibling::dtb:level1[not(dtb:h1)])+1"/>
<xsl:variable name="title"
Expand All @@ -79,7 +79,7 @@

<xsl:template match="dtb:bodymatter//dtb:level1[not(dtb:h1)]">
<xsl:variable name="language" select="('de',ancestor-or-self::*[@xml:lang|@lang]/(@xml:lang|@lang)[1])[last()]"/>
<xsl:variable name="blurb" select="pf:i18n-translate('original-without-numbering',$language,$translations)"/>
<xsl:variable name="blurb" select="pf:i18n-translate('original-without-numbering', $language, $translations)"/>
<xsl:variable name="level" >
<xsl:choose>
<xsl:when test="local-name() = 'level1'">1</xsl:when>
Expand All @@ -98,7 +98,7 @@
dtb:bodymatter//dtb:level5[not(dtb:h5)]|
dtb:bodymatter//dtb:level6[not(dtb:h6)]">
<xsl:variable name="language" select="('de',ancestor-or-self::*[@xml:lang|@lang]/(@xml:lang|@lang)[1])[last()]"/>
<xsl:variable name="blurb" select="pf:i18n-translate('without-heading',$language,$translations)"/>
<xsl:variable name="blurb" select="pf:i18n-translate('without-heading', $language, $translations)"/>
<xsl:apply-templates select="." mode="addHeading">
<xsl:with-param name="level" select="substring-after(name(), 'level')"/>
<xsl:with-param name="blurb" select="$blurb"/>
Expand Down

0 comments on commit 38b294a

Please sign in to comment.