Changeset 25242 for other-projects

Show
Ignore:
Timestamp:
21.03.2012 18:30:17 (8 years ago)
Author:
ak19
Message:

With Sam's help. 1. Updated gti-generate-excel-xml.xsl file to no longer output an excess of newlines. It now further turns ampersand characters in XML input files into their character entity values in the excel.xml file output. 2. Added 2 new XSLT files gti-generate-tmx-xml and gti-tmx-to-txt, which need to still be tested in practice. The first takes GS translation XML files containing chunks of strings to be translated and generates Translation Memory eXchange from it. TMX is an open-XML format also accepted by the Google Translation toolkit, so that translators can use this toolkit to do the translations if they wish. The 2nd XSLT file takes the TMX file returned by translators and outputs the UTF-16 txt file that was expected when processing spreadsheet translations previously, so that it fits into the same processing pipeline. These 2 new XSLT files, when applied by ApplyXSLT.jar/java on their input XML, require an additional parameter (the targetlanguage) and further take an optional parameter (source language). ApplyXSLT has been updated to work with this.

Location:
other-projects/gti
Files:
2 added
1 modified

Legend:

Unmodified
Added
Removed
  • other-projects/gti/gti-generate-excel-xml.xsl

    r24692 r25242  
    5454 
    5555  <xsl:template match="ChunksRequiringTranslation"> 
    56     <xsl:apply-templates> 
     56    <xsl:apply-templates select="Chunk"> 
    5757      <xsl:sort select="@key"/> 
    5858    </xsl:apply-templates> 
     
    6161 
    6262  <xsl:template match="ChunksRequiringUpdating"> 
    63     <xsl:apply-templates> 
     63    <xsl:apply-templates select="Chunk"> 
    6464      <xsl:sort select="@key"/> 
    6565    </xsl:apply-templates> 
     
    7979        <xsl:variable name="tempText1" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll(., "\n", "&amp;#10;&#10;")'/> 
    8080        <xsl:variable name="tempText2" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText1, "&#60;", "&amp;lt;")'/> 
    81         <xsl:variable name="escapedText" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText2, "&#62;", "&amp;gt;")'/> 
     81        <xsl:variable name="tempText3" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText2, "&#62;", "&amp;gt;")'/> 
     82        <xsl:variable name="escapedText" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText3, "&#38;", "&amp;amp;")'/> <!-- ampersands--> 
    8283        <xsl:value-of select='$escapedText' disable-output-escaping="yes"/> 
    8384          </xsl:for-each> 
     
    9596        <xsl:variable name="tempText1" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll(., "\n", "&amp;#10;&#10;")'/> 
    9697        <xsl:variable name="tempText2" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText1, "&#60;", "&amp;lt;")'/> 
    97         <xsl:variable name="escapedText" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText2, "&#62;", "&amp;gt;")'/> 
     98        <xsl:variable name="tempText3" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText2, "&#62;", "&amp;gt;")'/> 
     99        <xsl:variable name="escapedText" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText3, "&#38;", "&amp;amp;")'/> <!-- ampersands--> 
    98100        <xsl:value-of select='$escapedText' disable-output-escaping="yes"/> 
    99101          </xsl:for-each>