Ignore:
Timestamp:
2012-10-30T15:05:04+13:00 (11 years ago)
Author:
kjdon
Message:

got the language swap javascript out of the properties file and into the xsl file. No translator wants to see that stuff\!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/model-cols/niupepa/transform/pages/about.xsl

    r26348 r26409  
    2020    <!-- the page content -->
    2121    <xsl:template match="/page">
    22         <gsf:collectionText name="about.languageswap"/>
     22        <xsl:call-template name="languageswap"/>
    2323        <gsf:collectionText name="about.textxwelcome"/>
    2424        <gsf:collectionText name="about.textxwelcome2"/>
     
    3838        <gsf:collectionText name="about.textxsupporgs2"/>
    3939    </xsl:template>
     40
     41<xsl:template name="languageswap">
     42    <xsl:variable name="swaplangname"><xsl:choose><xsl:when test="/page/@lang = 'mi'">English</xsl:when><xsl:otherwise>Māori</xsl:otherwise></xsl:choose></xsl:variable>
     43<div style="text-align:right;"><small><a id="replaceLink"><xsl:attribute name="title"><gsf:collectionText name="about.changelangtofrommaori"/></xsl:attribute><xsl:value-of select="$swaplangname"/></a></small></div>
     44    <xsl:variable name="langcgiarg"><xsl:choose><xsl:when test="/page/@lang = 'mi'">l=en</xsl:when><xsl:otherwise>l=mi</xsl:otherwise></xsl:choose></xsl:variable>
     45<script type="text/javascript">
     46    <xsl:text disable-output-escaping="yes">
     47        $(window).ready(function()
     48        {
     49            var url = document.URL;
     50            if(url.indexOf("?") != -1)
     51            {
     52                if(url.search(/[&amp;?]?l=[^&amp;\b]*/g) != -1)
     53                {
     54                    url = url.replace(/([&amp;?]?)l=[^&amp;\b]*/g, "$1</xsl:text><xsl:value-of select="$langcgiarg"/><xsl:text disable-output-escaping="yes">");
     55                    $("#replaceLink").attr("href", url);
     56                }
     57                else
     58                {
     59                    $("#replaceLink").attr("href", url + "&amp;</xsl:text><xsl:value-of select="$langcgiarg"/><xsl:text disable-output-escaping="yes">");
     60                }
     61            }
     62            else
     63            {
     64                $("#replaceLink").attr("href", url + "?</xsl:text><xsl:value-of select="$langcgiarg"/><xsl:text disable-output-escaping="yes">");
     65            }
     66        });
     67    </xsl:text>
     68</script>
     69
     70</xsl:template>
    4071</xsl:stylesheet> 
    4172
Note: See TracChangeset for help on using the changeset viewer.