Hi Manuel,
In XLIFF resname is the attribute that is meant to have the identifier of the original resource.
(See http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#resname)
The id attribute is tool-specific. It may or may not correspond to the ID of the resource. It depends on how the tool doing the extraction/merge is handling references to the original document.
(See http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#id):
Id - Identifier - The id attribute is used in many elements as a reference to the original corresponding code data or format for the given element. The value of the id element is determined by the tool creating the XLIFF document. It may or may not be a resource identifier. The identifier of a resource should, at least, be stored in the resname attribute.
-ys
--
You received this message because you are subscribed to the Google Groups "okapi-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to okapi-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/okapi-users/CABm46bbxzRvhVo7wr9ZpSpqdBr_2eRGTB8b4pmjDvRWmdNTaHA%40mail.gmail.com.
id
attribute that I need to become the <trans-unit>'s id
which is what will be used in OmegaT to bind alternative translations.You can use one of the XML/ITS filter extension to select a specific resname.
But there is one case where it will not work: if you have an xml:id attribute, it will take precedence over any other declaration.
So, using your example, if you have:
<?xml version="1.0"?>
<root>
<label key="key1">
<text>Hello world</text>
</label>
<label key="key2">
<text>Hello world</text>
</label>
</root>
You can use the following config file:
<?xml version="1.0"?>
<its:rules version="1.0" xmlns:its=http://www.w3.org/2005/11/its
xmlns:itsx=http://www.w3.org/2008/12/its-extensions>
<its:translateRule selector="//text" translate="yes" itsx:idValue=../@key/>
</its:rules>
(for example in a file named okf...@test.fprm)
That will give you:
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:okp="okapi-framework:xliff-extensions" xmlns:its=http://www.w3.org/2005/11/its xmlns:itsxlf=http://www.w3.org/ns/its-xliff/ its:version="2.0">
<file original="test.xml" source-language="en-US" target-language="fr-FR" datatype="xml">
<body>
<trans-unit id="1" resname="key1">
<source xml:lang="en-US">Hello world</source>
<target xml:lang="fr-FR"></target>
</trans-unit>
<trans-unit id="2" resname="key2">
<source xml:lang="en-US">Hello world</source>
<target xml:lang="fr-FR"></target>
</trans-unit>
</body>
</file>
</xliff>
Where your key values are visible in resname attributes
The example files are attached.
I hope this helps.
-ys