externalise gettext functions, remove unnessesary import rules

svn path=/branches/test/; revision=30913
This commit is contained in:
paul 2015-03-26 16:48:20 +00:00
rodič 1b0e29241a
revize 78ea515b2e
33 změnil soubory, kde provedl 33 přidání a 294 odebrání

Zobrazit soubor

@ -4,9 +4,7 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dt="http://xsltsl.org/date-time">
<xsl:import href="../../tools/xsltsl/tagging.xsl" />
<xsl:import href="../../tools/xsltsl/countries.xsl" />
<xsl:import href="../../tools/xsltsl/translations.xsl" />
<xsl:import href="../../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

Zobrazit soubor

@ -2,8 +2,6 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="../../tools/xsltsl/tagging.xsl" />
<xsl:import href="../../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

Zobrazit soubor

@ -2,8 +2,6 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="../../tools/xsltsl/tagging.xsl" />
<xsl:import href="../../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

Zobrazit soubor

@ -4,9 +4,7 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dt="http://xsltsl.org/date-time">
<xsl:import href="../tools/xsltsl/tagging.xsl" />
<xsl:import href="../tools/xsltsl/countries.xsl" />
<xsl:import href="../tools/xsltsl/translations.xsl" />
<xsl:import href="../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

26
build/xslt/gettext.xsl Normal file
Zobrazit soubor

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- this template is to be called to get texts contained in "tools/texts-xx.xml" files -->
<xsl:template name="fsfe-gettext">
<xsl:param name="id" />
<xsl:choose>
<xsl:when test="/buildinfo/textset/text[@id=$id]">
<xsl:apply-templates select="/buildinfo/textset/text[@id=$id]/node()" />
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="/buildinfo/textsetbackup/text[@id=$id]/node()" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- this template is to be called to get texts contained in "tools/texts-content-xx.xml" files -->
<xsl:template name="gettext">
<xsl:param name="id" />
<xsl:value-of select="/buildinfo/textset/text[@id=$id] |
/buildinfo/textsetbackup/text[ @id=$id and not(@id=/buildinfo/textset/text/@id) ]"/>
</xsl:template>
</xsl:stylesheet>

Zobrazit soubor

@ -2,8 +2,6 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="../../tools/xsltsl/tagging.xsl" />
<xsl:import href="../../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

Zobrazit soubor

@ -2,8 +2,6 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="../../../tools/xsltsl/tagging.xsl" />
<xsl:import href="../../../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

Zobrazit soubor

@ -2,8 +2,6 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="../../../tools/xsltsl/tagging.xsl" />
<xsl:import href="../../../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

Zobrazit soubor

@ -2,8 +2,6 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="../../../tools/xsltsl/tagging.xsl" />
<xsl:import href="../../../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

Zobrazit soubor

@ -2,8 +2,6 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="../../../tools/xsltsl/tagging.xsl" />
<xsl:import href="../../../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

Zobrazit soubor

@ -2,8 +2,6 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="../../tools/xsltsl/tagging.xsl" />
<xsl:import href="../../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

Zobrazit soubor

@ -4,9 +4,7 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dt="http://xsltsl.org/date-time">
<xsl:import href="../tools/xsltsl/tagging.xsl" />
<xsl:import href="../tools/xsltsl/countries.xsl" />
<xsl:import href="../tools/xsltsl/translations.xsl" />
<xsl:import href="../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

Zobrazit soubor

@ -9,9 +9,9 @@
<xsl:include href="../../build/xslt/footer_sitenav.xsl" />
<xsl:include href="../../build/xslt/footer_sourcelink.xsl" />
<xsl:include href="../../build/xslt/footer_legal.xsl" />
<xsl:include href="../../build/xslt/gettext.xsl" />
<xsl:include href="../../tools/xsltsl/static-elements.xsl" />
<xsl:include href="../../tools/xsltsl/translations.xsl" />
<xsl:template name="page-body">
<xsl:element name="body">

Zobrazit soubor

@ -4,9 +4,7 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dt="http://xsltsl.org/date-time">
<xsl:import href="../tools/xsltsl/tagging.xsl" />
<xsl:import href="../tools/xsltsl/countries.xsl" />
<xsl:import href="../tools/xsltsl/translations.xsl" />
<xsl:import href="../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

Zobrazit soubor

@ -4,7 +4,6 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dt="http://xsltsl.org/date-time">
<xsl:import href="../tools/xsltsl/tagging.xsl" />
<xsl:import href="../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

Zobrazit soubor

@ -6,7 +6,7 @@
xmlns:str="http://exslt.org/strings"
extension-element-prefixes="str">
<xsl:import href="../tools/xsltsl/translations.xsl" />
<xsl:import href="../build/xslt/gettext.xsl" />
<xsl:import href="../tools/xsltsl/static-elements.xsl" />
<!-- HTML 5 compatibility doctype, since our XSLT parser doesn't support disabling output escaping -->

Zobrazit soubor

@ -4,7 +4,6 @@
<xsl:import href="default.xsl" />
<xsl:import href="xsl/quotes.xsl" />
<xsl:import href="../tools/xsltsl/tagging.xsl" />
<xsl:import href="../tools/xsltsl/translations.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

Zobrazit soubor

@ -4,7 +4,6 @@
<xsl:import href="default.xsl" />
<xsl:import href="xsl/quotes.xsl" />
<xsl:import href="../tools/xsltsl/tagging.xsl" />
<xsl:import href="../tools/xsltsl/translations.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

Zobrazit soubor

@ -4,9 +4,7 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dt="http://xsltsl.org/date-time">
<xsl:import href="../tools/xsltsl/tagging.xsl" />
<xsl:import href="../tools/xsltsl/countries.xsl" />
<xsl:import href="../tools/xsltsl/translations.xsl" />
<xsl:import href="../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

Zobrazit soubor

@ -4,9 +4,7 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dt="http://xsltsl.org/date-time">
<xsl:import href="../tools/xsltsl/tagging.xsl" />
<xsl:import href="../tools/xsltsl/countries.xsl" />
<xsl:import href="../tools/xsltsl/translations.xsl" />
<xsl:import href="../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

Zobrazit soubor

@ -6,7 +6,7 @@
xmlns:str="http://exslt.org/strings"
extension-element-prefixes="str">
<xsl:import href="tools/xsltsl/translations.xsl" />
<xsl:import href="build/xslt/gettext.xsl" />
<xsl:import href="tools/xsltsl/static-elements.xsl" />
<xsl:import href="tools/xsltsl/tagging.xsl" />

Zobrazit soubor

@ -2,8 +2,6 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="../../tools/xsltsl/tagging.xsl" />
<xsl:import href="../../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

Zobrazit soubor

@ -2,11 +2,9 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="tools/xsltsl/tagging.xsl" />
<xsl:import href="tools/xsltsl/translations.xsl" />
<xsl:import href="tools/xsltsl/static-elements.xsl" />
<xsl:import href="fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />
<xsl:template match="body">

Zobrazit soubor

@ -4,9 +4,7 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dt="http://xsltsl.org/date-time">
<xsl:import href="../tools/xsltsl/tagging.xsl" />
<xsl:import href="../tools/xsltsl/countries.xsl" />
<xsl:import href="../tools/xsltsl/translations.xsl" />
<xsl:import href="../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

Zobrazit soubor

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="../tools/xsltsl/tagging.xsl" />
<xsl:import href="../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

Zobrazit soubor

@ -2,10 +2,9 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="../tools/xsltsl/translations.xsl" />
<xsl:import href="../tools/xsltsl/static-elements.xsl" />
<xsl:import href="../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />
<xsl:template match="body">

Zobrazit soubor

@ -9,9 +9,9 @@
<xsl:include href="../../build/xslt/footer_sitenav.xsl" />
<xsl:include href="../../build/xslt/footer_sourcelink.xsl" />
<xsl:include href="../../build/xslt/footer_legal.xsl" />
<xsl:include href="../../build/xslt/gettext.xsl" />
<xsl:include href="../../tools/xsltsl/static-elements.xsl" />
<xsl:include href="../../tools/xsltsl/translations.xsl" />
<xsl:template name="page-body">
<xsl:element name="body">

Zobrazit soubor

@ -4,7 +4,7 @@
xmlns:str="http://exslt.org/strings"
extension-element-prefixes="str">
<xsl:import href="../tools/xsltsl/translations.xsl" />
<xsl:import href="../build/xslt/gettext.xsl" />
<xsl:import href="../tools/xsltsl/static-elements.xsl" />
<xsl:import href="../tools/xsltsl/tagging.xsl" />

Zobrazit soubor

@ -4,7 +4,6 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dt="http://xsltsl.org/date-time">
<xsl:import href="../tools/xsltsl/tagging.xsl" />
<xsl:import href="../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

Zobrazit soubor

@ -4,7 +4,6 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dt="http://xsltsl.org/date-time">
<xsl:import href="../tools/xsltsl/tagging.xsl" />
<xsl:import href="../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

Zobrazit soubor

@ -1,142 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="translations.xsl" />
<xsl:output method="xml" encoding="UTF-8" indent="yes" />
<xsl:template name="quote-box">
<xsl:param name="tag" select="''"/> <!-- if left empty, all quotes will be selected -->
<div id="cb1-back">
<xsl:call-template name="first-quote">
<xsl:with-param name="tag" select="$tag" />
</xsl:call-template>
</div>
<div id="cb1-front">
<!-- -->
</div>
<!-- javascript code for rotating quotes -->
<script type="text/javascript">
var quotes = [
<xsl:choose>
<xsl:when test="count(/buildinfo/textset/quotes/quote[@tag=$tag or $tag=''])>0">
<xsl:call-template name="get-js-quotes">
<xsl:with-param name="quotes-xpath" select="/buildinfo/textset/quotes/quote[@tag=$tag or $tag='']" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="get-js-quotes">
<xsl:with-param name="quotes-xpath" select="/buildinfo/textsetbackup/quotes/quote[@tag=$tag or $tag='']" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
];
var index = 0;
function changeImage () {
var oldIndex = index;
index = (index+1)%quotes.length;
var newContent =
"&lt;a href='/join/join.html'&gt;" +
"&lt;img src='"+quotes[index]['photo']+"' /&gt;" +
"&lt;p&gt;"+quotes[index]['text']+"&lt;br/&gt;"+
"&lt;strong&gt;"+quotes[index]['author']+"&lt;/strong&gt;&lt;/p&gt;"+
"&lt;/a&gt;";
$('#cb1-front').html($('#cb1-back').html());
$('#cb1-front').fadeIn(0);
$('#cb1-back').fadeOut(0);
$('#cb1-back').html(newContent);
$('#cb1-front').fadeOut('slow', function() {
$('#cb1-back').fadeIn('slow', function() {});
});
setTimeout("changeImage();",10000);
}
setTimeout("changeImage();",10000);
</script>
</xsl:template>
<xsl:template name="get-js-quotes">
<xsl:param name="quotes-xpath" />
<xsl:for-each select="$quotes-xpath">
<xsl:sort select="@pos" data-type="number" />
{
'photo': "<xsl:call-template name="get-quote-photo"><xsl:with-param name="id" select="@id" /></xsl:call-template>",
'text': "<xsl:call-template name="get-quote-text-escaped"><xsl:with-param name="id" select="@id" /></xsl:call-template>",
'author': "<xsl:call-template name="get-quote-author-escaped"><xsl:with-param name="id" select="@id" /></xsl:call-template>"
},
</xsl:for-each>
</xsl:template>
<xsl:template name="first-quote">
<xsl:param name="tag" />
<xsl:choose>
<xsl:when test="count(/buildinfo/textset/quotes/quote[@tag=$tag or $tag=''])>0">
<xsl:call-template name="display-first-quote">
<xsl:with-param name="quotes-xpath" select="/buildinfo/textset/quotes/quote[@tag=$tag or $tag='']" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise >
<xsl:call-template name="display-first-quote">
<xsl:with-param name="quotes-xpath" select="/buildinfo/textsetbackup/quotes/quote[@tag=$tag or $tag='']" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="display-first-quote">
<xsl:param name="quotes-xpath" />
<xsl:for-each select="$quotes-xpath">
<xsl:sort select="@pos" data-type="number" />
<xsl:if test="position() = 1">
<a href="/join/join.html">
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:call-template name="get-quote-photo">
<xsl:with-param name="id" select="@id" />
</xsl:call-template>
</xsl:attribute>
</xsl:element>
<p>
<xsl:call-template name="get-quote-text">
<xsl:with-param name="id" select="@id" />
</xsl:call-template>
<br/>
<strong>
<xsl:call-template name="get-quote-author">
<xsl:with-param name="id" select="@id" />
</xsl:call-template>
</strong>
</p>
</a>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

Zobrazit soubor

@ -28,106 +28,4 @@
/buildinfo/textsetbackup/text[ @id=$id and not(@id=/buildinfo/textset/text/@id) ]"/>
</xsl:template>
<!-- this template is to be called to get the text of _quotes_ contained in "tools/texts-xx.xml" files -->
<xsl:template name="get-quote-text">
<xsl:param name="id" />
<xsl:choose>
<xsl:when test="/buildinfo/textset/quotes/quote[@id=$id]/txt">
<xsl:value-of select="normalize-space(/buildinfo/textset/quotes/quote[@id=$id]/txt)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space(/buildinfo/textsetbackup/quotes/quote[@id=$id]/txt)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- this template is to be called to get the text of _quotes_ contained in "tools/texts-xx.xml" files -->
<xsl:template name="get-quote-text-escaped">
<xsl:param name="id" />
<xsl:choose>
<xsl:when test="/buildinfo/textset/quotes/quote[@id=$id]/txt">
<xsl:call-template name="escapeQuote">
<xsl:with-param name="pText" select="normalize-space(/buildinfo/textset/quotes/quote[@id=$id]/txt)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="escapeQuote">
<xsl:with-param name="pText" select="normalize-space(/buildinfo/textsetbackup/quotes/quote[@id=$id]/txt)"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- this template is to be called to get the image of _quotes_ contained in "tools/texts-xx.xml" files -->
<xsl:template name="get-quote-photo">
<xsl:param name="id" />
<xsl:choose>
<xsl:when test="/buildinfo/textset/quotes/quote[@id=$id]/photo">
<xsl:value-of select="normalize-space(/buildinfo/textset/quotes/quote[@id=$id]/photo)" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space(/buildinfo/textsetbackup/quotes/quote[@id=$id]/photo)" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- this template is to be called to get the author's nam of _quotes_ contained in "tools/texts-xx.xml" files -->
<xsl:template name="get-quote-author">
<xsl:param name="id" />
<xsl:choose>
<xsl:when test="/buildinfo/textset/quotes/quote[@id=$id]/author">
<xsl:value-of select="normalize-space(/buildinfo/textset/quotes/quote[@id=$id]/author)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space(/buildinfo/textsetbackup/quotes/quote[@id=$id]/author)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="get-quote-author-escaped">
<xsl:param name="id" />
<xsl:choose>
<xsl:when test="/buildinfo/textset/quotes/quote[@id=$id]/author">
<xsl:call-template name="escapeQuote">
<xsl:with-param name="pText" select="normalize-space(/buildinfo/textset/quotes/quote[@id=$id]/author)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="escapeQuote">
<xsl:with-param name="pText" select="normalize-space(/buildinfo/textsetbackup/quotes/quote[@id=$id]/author)"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="escapeQuote">
<xsl:param name="pText" select="."/>
<xsl:if test="string-length($pText) >0">
<xsl:value-of select=
"substring-before(concat($pText, '&quot;'), '&quot;')"/>
<xsl:if test="contains($pText, '&quot;')">
<xsl:text>\"</xsl:text>
<xsl:call-template name="escapeQuote">
<xsl:with-param name="pText" select=
"substring-after($pText, '&quot;')"/>
</xsl:call-template>
</xsl:if>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

Zobrazit soubor

@ -4,9 +4,7 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dt="http://xsltsl.org/date-time">
<xsl:import href="../tools/xsltsl/tagging.xsl" />
<xsl:import href="../tools/xsltsl/countries.xsl" />
<xsl:import href="../tools/xsltsl/translations.xsl" />
<xsl:import href="../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />