OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

xliff-users message

[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

<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";>
	<parent>
		<artifactId>build-examples</artifactId>
		<groupId>net.sf.okapi.examples</groupId>
		<version>0.27-SNAPSHOT</version>
	</parent>
	<modelVersion>4.0.0</modelVersion>
	<artifactId>okapi-example-06</artifactId>
	<name>Okapi Example 06</name>
	<repositories>
		<repository>
			<id>okapi-xliff</id>
			<name>okapi-xliff-repository</name>
			<url>http://repository-okapi-xliff.forge.cloudbees.com/snapshot/</url>
			<layout>default</layout>
		</repository>
	</repositories>
	<dependencies>
		<dependency>
			<groupId>net.sf.okapi</groupId>
			<artifactId>okapi-core</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>net.sf.okapi.filters</groupId>
			<artifactId>okapi-filter-openxml</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>net.sf.okapi.filters</groupId>
			<artifactId>okapi-filter-rainbowkit</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>net.sf.okapi.steps</groupId>
			<artifactId>okapi-step-rainbowkit</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>net.sf.okapi.lib</groupId>
			<artifactId>okapi-lib-xliff2</artifactId>
		</dependency>
	</dependencies>
</project>

Attachment: Main.java
Description: Binary data



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]