Changeset 25288 for other-projects
- Timestamp:
- 2012-03-26T17:39:57+13:00 (12 years ago)
- Location:
- other-projects/gti
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/gti/gti-tmx-to-spreadsheet.xsl
r25287 r25288 11 11 GS2/bin/script> java -cp /research/ak19/gs2-svn/bin/java/ApplyXSLT.jar org.nzdl.gsdl.ApplyXSLT -x ../../macros/maori/mi-core.xml -t ../script/gti-generate-tmx-xml.xsl -l mi > ../../maori/core-mi.tmx 12 12 13 3. Apply this XSLT to that XML file to obtain a unicode text file containing comma-separated values (a spreadsheet).13 3. Apply this XSLT to that XML file to obtain a unicode text file containing tab-separated values (a spreadsheet). 14 14 NOTE: Make sure the output is a *.txt file if you wish to open it in Excel without losing the unicode 15 15 (when opened with .csv extension, the unicode is not preserved). … … 17 17 GS2/bin/script> java -cp /research/ak19/gs2-svn/bin/java/ApplyXSLT.jar org.nzdl.gsdl.ApplyXSLT -x ../../maori/core-mi.tmx -t ../script/gti-tmx-to-spreadsheet.xsl > ../../maori/core-mi-tmx2spreadsheet.txt 18 18 19 4. Translators wishing to read this text file into Excel, need to first open Excel. Then go to File > Open, 20 and choose to open the unicode .txt file containing the comma-separated values. 19 4. Translators wishing to read this text file into Excel, need to first open Excel. 20 Then go to File > Open, set the filetypes drop-down to show All Files *.*, 21 and choose to open the unicode .txt file containing the tab-separated values. 21 22 22 23 - A wizard will appear, allowing users to open this .txt file as a proper spreadsheet. … … 25 26 b. in the drop down on the right, select unicode (UTF-8 or UTF-16) 26 27 c. Click next 27 In the second frame of the dialog, select " comma" as the delimiter. Click Finish to open the spreadsheet data.28 In the second frame of the dialog, select "tab" as the delimiter. Click Finish to open the spreadsheet data. 28 29 29 5. When translators have finished working on the file, they can save it simply as an Excel spreadsheet .xls file 30 (File > Save As > Excel 2003 spreadsheet) and mail it back to Greenstone. 31 Translators are advised against saving it as a .txt 2003 Excel spreadsheet, since it doesn't seem to preserve the 32 comma delimiters. 30 5. When translators have finished working on the file, save it as an Excel spreadsheet Unicode .txt file 31 (through File > Save As > Excel 2003 spreadsheet > choose Unicode .txt in the file types box) 32 and mail this text file back to Greenstone. 33 34 6. The file returned by the translator should first be processed with the new gti-process-google-spreadsheet.pl script: 35 GS2/bin/script>perl -S gti-process-google-spreadsheet.pl ~/Desktop/core-mi-xml2spreadsheet-out.txt > <language>-submission.xml 36 37 Then continue processing as usual 38 > cat <language>-submission.xml | perl -S gti.pl submit-translations <language-code> <module-name> <username> 39 33 40 --> 34 41 … … 40 47 41 48 <xsl:template match="tmx:body"> 42 <xsl:text>Source key&# 44;Source text,Target key,Target text</xsl:text><!--column headings-->49 <xsl:text>Source key	Source text	Target key	Target text</xsl:text><!--column headings separated by tabs--> 43 50 <xsl:text> </xsl:text> <!--newline--> 44 51 <xsl:apply-templates select="tmx:tu"/> … … 50 57 <xsl:text>source::</xsl:text> 51 58 <xsl:value-of select="tmx:prop"/> 52 <xsl:text>&# 44;</xsl:text><!-- comma-->59 <xsl:text>	</xsl:text><!-- tab --> 53 60 <xsl:variable name="tempText1"><xsl:value-of select="tmx:seg"/></xsl:variable> 54 61 <xsl:variable name="tempText2" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText1, "&#10; ", "&#10;")'/> … … 57 64 <xsl:variable name="escapedText" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText4, "&amp;", "&")'/> 58 65 <xsl:value-of select='$escapedText' disable-output-escaping="yes"/> 59 <xsl:text>&# 44;</xsl:text><!-- comma-->66 <xsl:text>	</xsl:text><!-- tab --> 60 67 </xsl:if> 61 68 </xsl:for-each> … … 65 72 <xsl:text>target::</xsl:text> 66 73 <xsl:value-of select="tmx:prop"/> 67 <xsl:text>&# 44;</xsl:text><!-- comma-->74 <xsl:text>	</xsl:text><!-- tab --> 68 75 <xsl:variable name="tempText1"><xsl:value-of select="tmx:seg"/></xsl:variable> 69 76 <xsl:variable name="tempText2" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText1, "&#10; ", "&#10;")'/> -
other-projects/gti/gti-xml-to-spreadsheet.xsl
r25287 r25288 8 8 GS2/bin/script> perl -S gti.pl get-first-n-chunks-requiring-work mi coredm 1000 > ../../macros/maori/mi-core.xml 9 9 10 2. Apply this XSLT to that XML file to obtain a unicode text file containing comma-separated values (a spreadsheet).10 2. Apply this XSLT to that XML file to obtain a unicode text file containing tab-separated values (a spreadsheet). 11 11 NOTE: Make sure the output is a *.txt file if you wish to open it in Excel without losing the unicode 12 12 (when opened with .csv extension, the unicode is not preserved). … … 14 14 GS2/bin/script> java -cp /research/ak19/gs2-svn/bin/java/ApplyXSLT.jar org.nzdl.gsdl.ApplyXSLT -x ../../macros/maori/mi-core.xml -t ../script/gti-xml-to-spreadsheet.xsl > ../../maori/core-mi-spreadsheet.txt 15 15 16 3. Translators wishing to read this text file into Excel, need to first open Excel. Then go to File > Open, 17 and choose to open the unicode .txt file containing the comma-separated values. 16 3. Translators wishing to read this text file into Excel, need to first open Excel. 17 Then go to File > Open, set the filetypes drop-down to show All Files *.*, 18 and choose to open the unicode .txt file containing the tab-separated values. 18 19 19 20 - A wizard will appear, allowing users to open this .txt file as a proper spreadsheet. … … 22 23 b. in the drop down on the right, select unicode (UTF-8 or UTF-16) 23 24 c. Click next 24 In the second frame of the dialog, select " comma" as the delimiter. Click Finish to open the spreadsheet data.25 In the second frame of the dialog, select "tab" as the delimiter. Click Finish to open the spreadsheet data. 25 26 26 4. When translators have finished working on the file, they can save it simply as an Excel spreadsheet .xls file 27 (File > Save As > Excel 2003 spreadsheet) and mail it back to Greenstone. 28 Translators are advised against saving it as a .txt 2003 Excel spreadsheet, since it doesn't seem to preserve the 29 comma delimiters. 27 4. When translators have finished working on the file, save it as an Excel spreadsheet Unicode .txt file 28 (through File > Save As > Excel 2003 spreadsheet > choose Unicode .txt in the file types box) 29 and mail this text file back to Greenstone. 30 31 5. The file returned by the translator should first be processed with the new gti-process-google-spreadsheet.pl script: 32 GS2/bin/script>perl -S gti-process-google-spreadsheet.pl ~/Desktop/core-mi-xml2spreadsheet-out.txt > <language>-submission.xml 33 34 Then continue processing as usual 35 > cat <language>-submission.xml | perl -S gti.pl submit-translations <language-code> <module-name> <username> 30 36 31 37 --> … … 34 40 35 41 <xsl:template match="GTIResponse"> 36 <xsl:text>Key&# 44;Source,Target</xsl:text><!--column headings-->42 <xsl:text>Key	Source	Target</xsl:text><!--column headings separated by tabs--> 37 43 <xsl:text> </xsl:text> <!--newline--> 38 44 <xsl:apply-templates select="ChunksRequiringUpdating"/> … … 55 61 <xsl:template match="Chunk"> 56 62 <xsl:value-of select="@key"/> 57 <xsl:text>&# 44;</xsl:text>63 <xsl:text>	</xsl:text> 58 64 <xsl:for-each select="SourceFileText"> 59 65 <xsl:variable name="escapedText" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll(., "\n", "&#10;")'/> 66 <!--<xsl:variable name="tempText2" select="java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText1, '\"', '&#34;')"/>--> <!-- escape (backslash-)quote with entity for quote--> 67 <!--<xsl:variable name="escapedText" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText1, ",", "&#44;")'/>--> <!--Escape commas in text, as they are not CSV delimiters--> 60 68 <xsl:value-of select='$escapedText' disable-output-escaping="yes"/> 61 69 </xsl:for-each> 62 70 <!--<xsl:value-of select="SourceFileText"/>--> 63 <xsl:text>&# 44;</xsl:text>71 <xsl:text>	</xsl:text> 64 72 <xsl:for-each select="TargetFileText"> 65 73 <xsl:variable name="escapedText" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll(., "\n", "&#10;")'/> 74 <!--<xsl:variable name="tempText2" select="java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText1, '\"', '&#34;')"/>--> <!-- escape (backslash-)quote with entity for quote--> 75 <!--<xsl:variable name="escapedText" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText1, ",", "&#44;")'/>--> <!--Escape commas in text, as they are not CSV delimiters--> 66 76 <xsl:value-of select='$escapedText' disable-output-escaping="yes"/> 67 77 </xsl:for-each>
Note:
See TracChangeset
for help on using the changeset viewer.