Skip to content

Instantly share code, notes, and snippets.

@nogajun
Last active November 19, 2022 04:33
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nogajun/358590ed77ccf58ee0441b3ae1a5e9e7 to your computer and use it in GitHub Desktop.
Save nogajun/358590ed77ccf58ee0441b3ae1a5e9e7 to your computer and use it in GitHub Desktop.
xsltprocを使って翻訳メモリのtmxファイルをcsvに変換するXSLTファイル
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="utf-8" />
<xsl:template match="/">
<xsl:text>"en-US"&#x9;"ja"</xsl:text>
<xsl:text>&#xA;</xsl:text>
<xsl:for-each select="tmx/body/tu">
<xsl:text>"</xsl:text>
<xsl:value-of select="tuv[@lang='en-US']/seg"/>
<xsl:text>"&#x9;"</xsl:text>
<xsl:value-of select="tuv[@lang='ja']/seg"/>
<xsl:text>"&#xA;</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
@nogajun
Copy link
Author

nogajun commented Feb 6, 2021

tmx2tsv.xsl (Convert TMX to TSV using xsltproc)

Use xsltproc to convert a translation memory TMX file to a TSV file.

Usage

$ xsltproc tmx2tsv.xsl file.tmx > file.tsv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment