Use resname as segment identifier (instead of correlative number)

Issue #49 resolved
Manuel Souto Pico created an issue

Current behavior

The Okapi XML filter can extract some property (the key below) as the resname, like so:

Given source text:

<label key="123" prop="foo">    
   <text>Hello world!</text>
</label>

The following extraction rule in the XML filter parameters file:

  <its:translateRule 
    selector="//text" 
    translate="yes" 
    itsx:idValue="parent::label/@key" 
   /> 

produces the following XLIFF:

<trans-unit id="1" resname="foo">

When the XML file with the parameters above is used directly in OmegaT (by means of the Okapi filters plugin for OmegaT), it’s possible to extract the resname but the segment's identifier is always (and can only be) the id attribute.

Request

Modify the plugin so that OmegaT can use the resname value, if it exists, as the segment’s identifier.

Proposed option in the Okapi filter options dialog in OmegaT:

☑️ Use ‘name’ attribute as segment identifier

Explanation / rationale

The segment’s identifier is what OmegaT uses to bind alternative translations (aka in-context exact --or ICE-- matches). When an Okapi filter is used, the segment’s identifier is the id attribute of the <trans-unit> element. In some projects, though, it would be handy to have alternative translations based on another detail (extracted as the unit name or resname) instead of the id.

In other words, for the exactly above, that would mean having alternative translations based on "foo" rather than "1".

This behavior already exists in the standard XLIFF filter that ships with OmegaT, which can be configured to bind alternative translations to the ID, the resname or the classical context (prev/next segments).

Comments (2)

  1. Log in to comment