Skip to content

Commit

Permalink
Merge pull request #596 from metanorma/i18n
Browse files Browse the repository at this point in the history
XSLT update for I18n strings
  • Loading branch information
Intelligent2013 authored Jul 17, 2023
2 parents 3088d8a + c1a8e8f commit 7f03545
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 59 deletions.
58 changes: 22 additions & 36 deletions xslt_src/common.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@


<!-- These titles of Table of contents renders different than determined in localized-strings -->
<title-toc lang="en">
<!-- <title-toc lang="en">
<xsl:if test="$namespace = 'csd' or $namespace = 'ieee' or $namespace = 'iho' or $namespace = 'mpfd' or $namespace = 'ogc' or $namespace = 'unece-rec'">
<xsl:text>Contents</xsl:text>
</xsl:if>
Expand All @@ -317,11 +317,12 @@
<xsl:if test="$namespace = 'gb'">
<xsl:text>Table of contents</xsl:text>
</xsl:if>
</title-toc>
<title-toc lang="fr">
</title-toc> -->
<title-toc lang="en">Table of contents</title-toc>
<!-- <title-toc lang="fr">
<xsl:text>Sommaire</xsl:text>
</title-toc>
<title-toc lang="zh">
</title-toc> -->
<!-- <title-toc lang="zh">
<xsl:choose>
<xsl:when test="$namespace = 'gb'">
<xsl:text>目次</xsl:text>
Expand All @@ -330,9 +331,8 @@
<xsl:text>Contents</xsl:text>
</xsl:otherwise>
</xsl:choose>
</title-toc>

<title-descriptors lang="en">Descriptors</title-descriptors>
</title-toc> -->
<title-toc lang="zh">目次</title-toc>

<title-part lang="en">
<xsl:if test="$namespace = 'bsi' or $namespace = 'iso'">
Expand Down Expand Up @@ -369,29 +369,15 @@
<title-subpart lang="en">Sub-part #</title-subpart>
<title-subpart lang="fr">Partie de sub #</title-subpart>

<title-list-tables lang="en">List of Tables</title-list-tables>

<title-list-figures lang="en">List of Figures</title-list-figures>

<title-table-figures lang="en">Table of Figures</title-table-figures>

<title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>

<title-summary lang="en">Summary</title-summary>

<title-continued lang="ru">(продолжение)</title-continued>
<title-continued lang="en">(continued)</title-continued>
<title-continued lang="fr">(continué)</title-continued>

</xsl:variable>
<xsl:variable name="titles" select="xalan:nodeset($titles_)"/>

<xsl:variable name="title-list-tables">
<xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
<xsl:value-of select="$toc_table_title"/>
<xsl:if test="normalize-space($toc_table_title) = ''">
<xsl:call-template name="getTitle">
<xsl:with-param name="name" select="'title-list-tables'"/>
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">toc_tables</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:variable>
Expand All @@ -400,8 +386,8 @@
<xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
<xsl:value-of select="$toc_figure_title"/>
<xsl:if test="normalize-space($toc_figure_title) = ''">
<xsl:call-template name="getTitle">
<xsl:with-param name="name" select="'title-list-figures'"/>
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">toc_figures</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:variable>
Expand All @@ -410,8 +396,8 @@
<xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
<xsl:value-of select="$toc_requirement_title"/>
<xsl:if test="normalize-space($toc_requirement_title) = ''">
<xsl:call-template name="getTitle">
<xsl:with-param name="name" select="'title-list-recommendations'"/>
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">toc_recommendations</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:variable>
Expand Down Expand Up @@ -7796,17 +7782,17 @@
<fo:table-body>
<xsl:if test="$namespace = 'bsi' or $namespace = 'iec' or $namespace = 'ieee' or $namespace = 'iso' or $namespace = 'jcgm'">
<xsl:variable name="title_continued_">
<xsl:call-template name="getTitle">
<xsl:with-param name="name" select="'title-continued'"/>
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">continued</xsl:with-param>
</xsl:call-template>
</xsl:variable>

<xsl:variable name="title_continued_in_parenthesis" select="concat('(',$title_continued_,')')"/>
<xsl:variable name="title_continued">
<xsl:if test="$namespace = 'iec' or $namespace = 'ieee' or $namespace = 'iso' or $namespace = 'jcgm'"><xsl:value-of select="$title_continued_"/></xsl:if>
<xsl:if test="$namespace = 'iec' or $namespace = 'ieee' or $namespace = 'iso' or $namespace = 'jcgm'"><xsl:value-of select="$title_continued_in_parenthesis"/></xsl:if>
<xsl:if test="$namespace = 'bsi'">
<xsl:choose>
<xsl:when test="$document_type = 'PAS'">— <xsl:value-of select="translate($title_continued_, '()', '')"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$title_continued_"/></xsl:otherwise>
<xsl:when test="$document_type = 'PAS'">— <xsl:value-of select="$title_continued_"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$title_continued_in_parenthesis"/></xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:variable>
Expand Down Expand Up @@ -12840,8 +12826,8 @@
<xsl:if test="$list_of_tables_figures//table_figure">
<fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
<fo:bookmark-title>
<xsl:call-template name="getTitle">
<xsl:with-param name="name" select="'title-table-figures'"/>
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">table_of_figures</xsl:with-param>
</xsl:call-template>
</fo:bookmark-title>
<xsl:for-each select="$list_of_tables_figures//table_figure">
Expand Down
9 changes: 3 additions & 6 deletions xslt_src/csa.standard.core.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,9 @@
</xsl:template>

<xsl:template match="csa:preface/csa:clause[@type = 'toc']/csa:title" priority="3">
<xsl:variable name="title-toc">
<xsl:call-template name="getTitle">
<xsl:with-param name="name" select="'title-toc'"/>
</xsl:call-template>
</xsl:variable>
<fo:block font-size="26pt" color="black" margin-top="2pt" margin-bottom="30pt" role="H1"><xsl:value-of select="$title-toc"/></fo:block>
<fo:block font-size="26pt" color="black" margin-top="2pt" margin-bottom="30pt" role="H1">
<xsl:apply-templates />
</fo:block>
</xsl:template>

<xsl:template match="node()">
Expand Down
22 changes: 19 additions & 3 deletions xslt_src/iec.international-standard.core.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,13 @@
<fo:block-container background-color="rgb(219, 229, 241)" margin-top="4mm" padding="2mm" padding-top="1mm" border="1.5pt solid white">
<fo:block font-size="6.5pt" margin-bottom="6pt">
<xsl:call-template name="addLetterSpacingSmallCaps">
<xsl:with-param name="text">Title:</xsl:with-param>
<xsl:with-param name="text">
<!-- Title: -->
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">title</xsl:with-param>
</xsl:call-template>
<xsl:text>:</xsl:text>
</xsl:with-param>
</xsl:call-template>
</fo:block>
<fo:block font-size="9pt" font-weight="bold">
Expand All @@ -855,7 +861,11 @@
<fo:block font-size="6.5pt">
<xsl:call-template name="addLetterSpacing">
<xsl:with-param name="text">
<xsl:text>PROPOSED STABILITY DATE: </xsl:text>
<!-- PROPOSED STABILITY DATE: -->
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">proposed_stability_date</xsl:with-param>
</xsl:call-template>
<xsl:text>: </xsl:text>
</xsl:with-param>
</xsl:call-template>
<!-- 2023 -->
Expand All @@ -867,7 +877,13 @@
<fo:block-container border="1.5 solid" border-color="rgb(221, 213, 213)" padding="1mm" margin-top="3mm">
<fo:block font-size="6.5pt" margin-bottom="6pt">
<xsl:call-template name="addLetterSpacingSmallCaps">
<xsl:with-param name="text">Note from TC/SC officers:</xsl:with-param>
<xsl:with-param name="text">
<!-- Note from TC/SC officers: -->
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">tc_sc_note</xsl:with-param>
</xsl:call-template>
<xsl:text>:</xsl:text>
</xsl:with-param>
</xsl:call-template>
</fo:block>
<!-- Example: This FDIS is the result of the discussion between the IEC SC21A experts WG 3 during the meeting held in -->
Expand Down
32 changes: 26 additions & 6 deletions xslt_src/iso.international-standard.core.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -763,10 +763,20 @@
<fo:block>&#xA0;</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Voting begins on:</fo:block>
<fo:block>
<!-- Voting begins on: -->
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">voting_begins_on</xsl:with-param>
</xsl:call-template><xsl:text>:</xsl:text>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Voting terminates on:</fo:block>
<fo:block>
<!-- Voting terminates on: -->
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">voting_terminates_on</xsl:with-param>
</xsl:call-template><xsl:text>:</xsl:text>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
Expand Down Expand Up @@ -1011,7 +1021,12 @@
<fo:block margin="2mm" role="SKIP">
<fo:block margin-bottom="8pt"><xsl:copy-of select="$editorialgroup"/></fo:block>
<fo:block margin-bottom="6pt"><xsl:copy-of select="$secretariat"/></fo:block>
<fo:block margin-bottom="6pt">Voting begins on:<xsl:value-of select="$linebreak"/>
<fo:block margin-bottom="6pt">
<!-- Voting begins on: -->
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">voting_begins_on</xsl:with-param>
</xsl:call-template><xsl:text>:</xsl:text>
<xsl:value-of select="$linebreak"/>
<fo:inline font-weight="bold">
<xsl:choose>
<xsl:when test="/iso:iso-standard/iso:bibdata/iso:date[@type = 'vote-started']/iso:on">
Expand All @@ -1021,7 +1036,12 @@
</xsl:choose>
</fo:inline>
</fo:block>
<fo:block>Voting terminates on:<xsl:value-of select="$linebreak"/>
<fo:block>
<!-- Voting terminates on: -->
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">voting_terminates_on</xsl:with-param>
</xsl:call-template><xsl:text>:</xsl:text>
<xsl:value-of select="$linebreak"/>
<fo:inline font-weight="bold">
<xsl:choose>
<xsl:when test="/iso:iso-standard/iso:bibdata/iso:date[@type = 'vote-ended']/iso:on">
Expand Down Expand Up @@ -1510,8 +1530,8 @@
<xsl:if test="/iso:iso-standard/iso:bibdata/iso:keyword">
<fo:block font-size="9pt" margin-bottom="6pt">
<xsl:variable name="title-descriptors">
<xsl:call-template name="getTitle">
<xsl:with-param name="name" select="'title-descriptors'"/>
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">Descriptor.pl</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<fo:inline font-weight="bold"><xsl:value-of select="$title-descriptors"/>: </fo:inline>
Expand Down
42 changes: 36 additions & 6 deletions xslt_src/ogc.standard.core.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,12 @@
<fo:block line-height="140%">
<xsl:apply-templates select="/ogc:ogc-standard/ogc:bibdata/ogc:edition[normalize-space(@language) = '']"/>
<fo:block>
<fo:inline font-weight="bold">Submission Date: </fo:inline>
<fo:inline font-weight="bold">
<!-- Submission Date: -->
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">submission_date</xsl:with-param>
</xsl:call-template><xsl:text>: </xsl:text>
</fo:inline>
<xsl:choose>
<xsl:when test="/ogc:ogc-standard/ogc:bibdata/ogc:date[@type = 'received']/ogc:on">
<xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:date[@type = 'received']/ogc:on"/>
Expand All @@ -327,7 +332,12 @@
</xsl:choose>
</fo:block>
<fo:block>
<fo:inline font-weight="bold">Approval Date: </fo:inline>
<fo:inline font-weight="bold">
<!-- Approval Date: -->
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">approval_date</xsl:with-param>
</xsl:call-template><xsl:text>: </xsl:text>
</fo:inline>
<xsl:choose>
<xsl:when test="/ogc:ogc-standard/ogc:bibdata/ogc:date[@type = 'issued']/ogc:on">
<xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:date[@type = 'issued']/ogc:on"/>
Expand All @@ -336,14 +346,24 @@
</xsl:choose>
</fo:block>
<fo:block>
<fo:inline font-weight="bold">Publication Date: </fo:inline>
<fo:inline font-weight="bold">
<!-- Publication Date: -->
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">publication_date</xsl:with-param>
</xsl:call-template><xsl:text>: </xsl:text>
</fo:inline>
<xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:date[@type = 'published']/ogc:on"/>
</fo:block>

<fo:block margin-bottom="12pt">
<xsl:if test="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='author']/ogc:person/ogc:name/ogc:completename">
<fo:block>
<fo:inline font-weight="bold">Author: </fo:inline>
<fo:inline font-weight="bold">
<!-- Author: -->
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">author</xsl:with-param>
</xsl:call-template><xsl:text>: </xsl:text>
</fo:inline>
<xsl:for-each select="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='author']/ogc:person/ogc:name/ogc:completename">
<xsl:value-of select="."/>
<xsl:if test="position() != last()">, </xsl:if>
Expand All @@ -352,7 +372,12 @@
</xsl:if>
<xsl:if test="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='editor']/ogc:person/ogc:name/ogc:completename">
<fo:block>
<fo:inline font-weight="bold">Editor: </fo:inline>
<fo:inline font-weight="bold">
<!-- Editor: -->
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">editor</xsl:with-param>
</xsl:call-template><xsl:text>: </xsl:text>
</fo:inline>
<xsl:for-each select="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='editor']/ogc:person/ogc:name/ogc:completename">
<xsl:value-of select="."/>
<xsl:if test="position() != last()">, </xsl:if>
Expand All @@ -361,7 +386,12 @@
</xsl:if>
<xsl:if test="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='contributor']/ogc:person/ogc:name/ogc:completename">
<fo:block>
<fo:inline font-weight="bold">Contributor: </fo:inline>
<fo:inline font-weight="bold">
<!-- Contributor: -->
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">contributor</xsl:with-param>
</xsl:call-template><xsl:text>: </xsl:text>
</fo:inline>
<xsl:for-each select="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='contributor']/ogc:person/ogc:name/ogc:completename">
<xsl:value-of select="."/>
<xsl:if test="position() != last()">, </xsl:if>
Expand Down
4 changes: 2 additions & 2 deletions xslt_src/ogc.white-paper.core.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@
<fo:block font-size="11pt" margin-top="8pt">&#xA0;</fo:block>
<fo:block xsl:use-attribute-sets="title-toc-style">
<!-- <xsl:text>Table of Figures</xsl:text> -->
<xsl:call-template name="getTitle">
<xsl:with-param name="name" select="'title-table-figures'"/>
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">table_of_figures</xsl:with-param>
</xsl:call-template>
</fo:block>
<xsl:for-each select="//ogc:figure[@id and ogc:name] | //ogc:table[@id and ogc:name]">
Expand Down

0 comments on commit 7f03545

Please sign in to comment.