YAML – Ain’t that difficult to translate in Trados Studio anymore

Supertext has developed a third file type plugin for Trados Studio 2015 – 2017.

What can you do with it?

  • Translate YAML files (*.yaml, *.yml) directly in Trados Studio
  • Translate all texts
  • Use a path filter to:
    • Translate only specific texts
    • Translate bilingual YAML files
  • Process embedded content such as HTML tags

Download and installation

Download the plugin here and double click on the .sdlplugin file to start the plugin installer.

If the file type doesn’t show up in the “File Types” list, you may find it when clicking on “Additional installed File Types exist”:

YAML format

YAML stands for “Ain’t Markup Language” and is a human-readable data serialization standard. It is mostly used for configuration files, but can also be used as data-interchange format for the storage and exchange of any data. It is similar to the JSON format, but provides additional features that JSON lacks.

More information about this format can be found on Wikipedia, on the official website, or on many other websites.

YAML path

A YAML document can be represented as a tree.  The example above:

A path describes how to get to a node of the tree. We are only interested in paths that lead to scalars (represented as leaves in the tree) with content that contains text.

Example path that leads to the scalar with content “The YAML example”: header.title

Example path that leads to the scalar with content “First element additional text”: content.elements[0].additionalText

Translate all YAML file texts

You’ll be able to use YAML files in your Trados projects once the plugin is installed. By default, the parser will extract all texts and no setting changes are required.

Use a path filter

The path filter setting can be found in the project settings under File Types -> YAML file -> Parsing settings. The filter rules are defined using regular expression. Each rule defines two expressions.

The source path expression is used to describe the pattern a path must match to be used as source, and therefore the scalar’s content as source text. If a path does not match any source path expressions, it is ignored. This way you can control what is used as translatable text.

The target path expression is used to describe the pattern of the path that should be used as target, and therefore the scalar’s content as target text. This expression needs to be the same as the source expression if the source text is to be replaced with the target text. However, if the YAML document is bilingual and therefore contains source as well as target text, it will be different from the source expression.

Translate only specific texts

You can either add filter rules yourself or extract all existing rules from a YAML file and then remove the rules matching the unwanted texts.

Example settings to get the header title and all “additionalText” properties of the above YAML document:

You could use “content\.elements\[0\]\.additionalText” instead of “content\.elements\[\d+\]\.additionalText” as the path expression to get only the first “additionalText”.

It is possible to use only “title” instead of “header\.title” and “content\.title” if both title properties should be translated, since the parser checks if the path contains the described pattern.

Translate bilingual YAML files

It is possible to specify a target path expression if the YAML document to translate is bilingual.

In this case you need to mark the rule as bilingual and define the target path expression.

Select “Apply target text from YAML file” to extract any existing target text from the YAML file.

The extraction feature does not recognize source and target. The path expressions for source and target will be defined in separate rules; however, it is possible to join the rules:

  1. Hold down the Ctrl key on your keyboard
  2. Click on the first rule to select it
  3. Click on the second rule to select it
  4. Release the Ctrl key and click on the Join button

Process embedded content like HTML tags

The plugin supports embedded content replacement with tags. The default settings already contain common placeholders and tag pairs for HTML. This setting can be found under File Types -> YAML file -> Embedded Content.



Related posts


Ein Kommentar zu “YAML – Ain’t that difficult to translate in Trados Studio anymore”



  • François Chalumeau am 20. June 2017 10:47 Uhr

    Hello,

    I installed your plugin in my SDL Studio environment (2015 Freelance, SR3), but the YAML file type does not appear. Any reason?

    Looking forward to reading your reply
    Best regards


Leave a Reply

Your email address will not be published. Required fields are marked *