XLIFF 2 filter -- formatting lost in target
Preconditions
Plugin okapiFiltersForOmegaT-1.13-1.45.0.jar is installed in your plugins folder in OmegaT.
An OmegaT project (attached) that uses the Okapi XLIFF 2.0 filter and an XLIFF file that contains this unit:
<unit id="24">
<mda:metadata id="24">
<mda:metaGroup category="attributes" id="ph0">
<mda:meta type="ctype">x-italic</mda:meta>
</mda:metaGroup>
<mda:metaGroup category="attributes" id="ph2">
<mda:meta type="ctype">x-bold</mda:meta>
</mda:metaGroup>
</mda:metadata>
<originalData>
<data id="ph0"><i></data>
<data id="ph1"></i></data>
<data id="ph2"><b></data>
<data id="ph3"></b></data>
</originalData>
<segment id="24">
<source xml:space="preserve">The <ph id="ph0"/>yellow<ph id="ph1"/> <ph id="ph2"/>submarine<ph id="ph3"/> was a great song.</source>
</segment>
</unit>
The original HTML file looks like this:
<div>The <i>yellow</i> <b>submarine</b> was a great song.</div>
and renders:
The yellow submarine was a great song.
Steps to reproduce
- Open the attached project in OmegaT.
- Press Ctrl+D to generate target files.
- Open the target folder of the projec and inspect the target files.
Expected results
Formatting data (element <originalData>) is maintained:
<unit id="24">
<mda:metadata id="24">
<mda:metaGroup category="attributes" id="ph0">
<mda:meta type="ctype">x-italic</mda:meta>
</mda:metaGroup>
<mda:metaGroup category="attributes" id="ph2">
<mda:meta type="ctype">x-bold</mda:meta>
</mda:metaGroup>
</mda:metadata>
<originalData>
<data id="ph0"><i></data>
<data id="ph1"></i></data>
<data id="ph2"><b></data>
<data id="ph3"></b></data>
</originalData>
<segment state="final" id="24">
<source xml:space="preserve">The <ph id="ph0"/>yellow<ph id="ph1"/> <ph id="ph2"/>submarine<ph id="ph3"/> was a great song.</source>
<target xml:space="preserve">Le <ph id="ph0"/>jaune<ph id="ph1"/> <ph id="ph2"/>sous-marin<ph id="ph3"/> était une grande chanson.</target>
</segment>
</unit>
When the translated XLIFF is merged, the merged HTML file look like this:
<div>Le <i>jaune</i> <b>sous-marin</b> était une grande chanson.</div>
Actual results
Formatting data (element <originalData>) is lost:
<unit id="24">
<mda:metadata id="24">
<mda:metaGroup id="ph0" category="attributes">
<mda:meta type="ctype">x-italic</mda:meta>
</mda:metaGroup>
<mda:metaGroup id="ph2" category="attributes">
<mda:meta type="ctype">x-bold</mda:meta>
</mda:metaGroup>
</mda:metadata>
<segment id="24" state="translated">
<source xml:space="preserve">The <ph id="ph0"/>yellow<ph id="ph1"/> <ph id="ph2"/>submarine<ph id="ph3"/> was a great song.</source>
<target xml:space="preserve">Le <ph id="ph2"/>sous-marin<ph id="ph3"/> <ph id="ph0"/>jaune<ph id="ph1"/> était une grande chanson. </target>
</segment>
</unit>
When the translated XLIFF is merged, the merged HTML file look like this:
<div>Le sous-marin jaune était une grande chanson. </div>
Hence formatting markup is gone.
Data
Project package attached: okapi-plugin_issue-276_xliff2-mrkp_OMT.omt
Edited by Manuel Souto Pico