Dear all,
I'm trying to convert a bilingual JSON file to a bilingual XLIFF.
My input is something like this:
[
{
"id": 1,
"source_text": "Hello world",
"target_text": "Hallo Welt!"
},
{
"id": 2,
"source_text": "Foo",
"target_text": "Bar"
}
]
and I trying to obtain something like this:
<trans-unit id="sg2_sf1_tu1" resname="source_text_1">
<source xml:lang="en">Hello world</source>
<target xml:lang="de">Hallo Welt!</target>
</trans-unit>
<trans-unit id="sg3_sf2_tu1" resname="source_text_1">
<source xml:lang="en">Foo</source>
<target xml:lang="de">Bar</target>
</trans-unit>
I have tried creating a Rainbow project with the ID-based Copy step and two custom filters:
- On Input List 1, I add the JSON file and extract the 'source_text' key, and match the 'id' key for the resname.
- On Input List 1, I add the JSON file again and extract the 'target_text' key, and match the 'id' key for the resname.
I would assume the 'id' key is what would allow Rainbow to copy the target text of the second input and use it as the target of the first input based on matching id. However, I get this
=== Start process
Input: /home/pico/Sync/IEA/JSON/file.json
WARNING: Duplicate id detected: target_text_1
WARNING: Id 'target_text_1' is in the second file, but not in the main input.
Error count: 0, Warning count: 2
Process duration: 0h 0m 0s 982ms
=== End process
and the XLIFF file produced does not include the target text of the second input as the translation.
How can I manage to achieve this?
I'm attaching the filters, project and source files.
Thanks in advance for any tips.
Cheers, Manuel