[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [xliff-users] XLIFF 2.0 examples for writing test cases
Hi Chris,
> I have another question regarding XLIFF 2.0 creation. I want to
> provide conversion to/from XLIFF as a component of a prototype
> CAT tool. The goal is to hook in to the Okapi API to convert
> to/from the user's format (i.e. DOCX --> XLIFF --> DOCX).
> It's really important to be able to go back to the user's
> original format after translation has finished.
> Could someone point me to the place(s) in the Okapi source
> code where I should hook in?
--- The (relatively) short answer:
Use the "Rainbow Translation Kit Creation" component to extract and the "Rainbow Translation Kit Merging" one to merge back.
They are here:
\trunk\okapi\steps\rainbowkit\src\main\java\net\sf\okapi\steps\rainbowkit\creation\ExtractionStep.java
And here:
\trunk\okapi\steps\rainbowkit\src\main\java\net\sf\okapi\steps\rainbowkit\postprocess\MergingStep.java
This would require you to use a pipeline.
I've attached some example code that extract, modify and merge back a single .docx file using a simple pipeline with those components for extraction and merging. I've also included the POM file so you can see the dependencies.
--- The longer answer (which hopefully you don't need):
Converting to/from various format is currently implemented using the okapi internal object model. The various filters extract/merge to/from that model and there are two steps that allow you to go to/from XLIFF from/to that object model. There are:
https://code.google.com/p/okapi/source/browse/okapi/steps/rainbowkit/src/main/java/net/sf/okapi/steps/rainbowkit/creation/ExtractionStep.java
And here:
https://code.google.com/p/okapi/source/browse/okapi/steps/rainbowkit/src/main/java/net/sf/okapi/steps/rainbowkit/postprocess/MergingStep.java
(Using the RainbowKit filter, which is here:
https://code.google.com/p/okapi/source/browse/okapi/#okapi%2Ffilters%2Frainbowkit%2Fsrc%2Fmain%2Fjava%2Fnet%2Fsf%2Fokapi%2Ffilters%2Frainbowkit
)
More specifically, the writing from the internal OM to XLIFF2 is done here:
https://code.google.com/p/okapi/source/browse/okapi/steps/rainbowkit/src/main/java/net/sf/okapi/steps/rainbowkit/xliff/XLIFF2PackageWriter.java
And the conversion from the XLIFF2 file back into the internal OM is done here:
https://code.google.com/p/okapi/source/browse/okapi/filters/rainbowkit/src/main/java/net/sf/okapi/filters/rainbowkit/XLIFF2Filter.java
Hope this helps,
-yves
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]