Parsing settings for YAML file plugin

I am trying to parse the value language strings in source and target columns in the Editor in the snippet of YML code below.

---
permanent_link: adult_consent
linked_steps:
- step_index: 0
  content:
    translations:
    - locale: en
      field: title
      value: Before We Begin
    - locale: es
      field: title
      value: Before We Begin

When I use the Extract button on the file, I get the following for the Source path expression

linked_steps\[\d+\]\.content\.translations\[\d+\]\.value 

When I import the file into Trados, both values are in the source column in the Editor.

How should I write this for a bilingual file in the Source Path Expression and the Target Path Expression?

 

Parents
  • Hello  

    I tested this with the latest version of the YAML filetype on the appstore, using default settings, and get this:

    Screenshot of Trados Studio showing a YAML file with sections labeled 'adult_consent', 'en', 'title', 'Before We Begin', 'es', and 'Test.yaml'.

    Perhaps you should make sure you have the latest version of the filetype and test it again?

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 2:25 PM (GMT 0) on 28 Feb 2024]
  • Paul, that seems to be exactly the problem... this loads ALL content as source.

    David needs to load the "en" part as a source and the "es" part as target.

    IMO the file structure is localization-unfriendly, to say the least... because the "field" and "value" fields are on the same level as the "locale" field... while one would expect them to be placed UNDER the "locale" level... something like this:

    permanent_link: adult_consent
    linked_steps:
    - step_index: 0
     content:
       translations:
         en:
           field: title
           value: Before We Begin
         es:
           field: title
           value: Before We Begin

    or even simpler like this:

    permanent_link: adult_consent
    linked_steps:
    - step_index: 0
      content:
        translations:
          en:
            title: Before We Begin
          es:
            title: Before We Begin

    Or yet simpler, without the unneeded "translations" level:

    permanent_link: adult_consent
    linked_steps:
    - step_index: 0
      content:
        en:
          title: Before We Begin
        es:
          title: Before We Begin
  • You understood exactly why I asked the question. Thank you.

    We imported the content we needed using the following method. I think there was a better way of doing it but for now this is what we did.

    Since the Spanish was the second instance in the array of language values, the paths were written to have every other value imported. We wrote the paths as follows:

    linked_steps\[\d+\]\.inputs\[\d+\]\.choices\[\d+\]\.translations\[1\]\.value
    linked_steps\[\d+\]\.inputs\[\d+\]\.choices\[\d+\]\.translations\[3\]\.value
    linked_steps\[\d+\]\.inputs\[\d+\]\.choices\[\d+\]\.translations\[5\]\.value
    linked_steps\[\d+\]\.inputs\[\d+\]\.choices\[\d+\]\.translations\[7\]\.value

    I was hoping there was a way to write this in regex to read every other instance but this seemed like the only way it would work correctly.
Reply
  • You understood exactly why I asked the question. Thank you.

    We imported the content we needed using the following method. I think there was a better way of doing it but for now this is what we did.

    Since the Spanish was the second instance in the array of language values, the paths were written to have every other value imported. We wrote the paths as follows:

    linked_steps\[\d+\]\.inputs\[\d+\]\.choices\[\d+\]\.translations\[1\]\.value
    linked_steps\[\d+\]\.inputs\[\d+\]\.choices\[\d+\]\.translations\[3\]\.value
    linked_steps\[\d+\]\.inputs\[\d+\]\.choices\[\d+\]\.translations\[5\]\.value
    linked_steps\[\d+\]\.inputs\[\d+\]\.choices\[\d+\]\.translations\[7\]\.value

    I was hoping there was a way to write this in regex to read every other instance but this seemed like the only way it would work correctly.
Children
No Data