YAML/YML Files

Hi

I have a couple of problems with YAML/YML files that I'd like to find the best way to resolve. Hopefully others have had similar issues they've managed to solve.

I'm running Passolo 2018 Teams Edition.

Comments in YAML/YML files

I found out today that our developers have been marking YAML/YML source files with comments such as:

performance_drivers:
# Don't translate this
performance_drivers_label: "{count, plural, =1 {1 {singularCustomName}} other {# {pluralCustomName}}}"

You can see these comments if you click the "Show Resources" button whilst in a string list, but it's not ideal.

I'm stumped as to how to tell Passolo not to offer such strings as translatable. Ideally I'd like to have some mechanism that will automatically find and make these read only during parsing. The YAML/YML parser does not seem to have any configurable options for handling this type of thing.

Special YAML/YML strings

Our developers are also using both variables in the YAML/YML strings and the "pluralise" notation that, whilst enhancing the end-user experience, it introduces issues for translation. As far as I can tell, the Passolo YAML/YML parser does not treat these as anything special, and unfortunately, I'm finding in some circumstances, translators are changing text that should not be changed, and leaving text alone that should be changed. I'm trying to educate them but it's quite tricky to get it right. For example, I've highlighted where translation should occur in these two examples:

others: "{count, plural, =0 {no one} =1 {one other} other {# others}}"

performance_drivers_label: "{count, plural, =1 {1 {singularCustomName}} other {# {pluralCustomName}}}"

The Review>Check function in Passolo has nothing specific to YAML/YML files which is a shame as I have 6000+ strings across 11 languages to check for errors. 

Does anyone have any methods or techniques for handling similar situations they'd be happy to share? The alternative is to create my own checker.

Thanks!
Mark

Parents
  • Comments in YAML

    When reading the YAML specification (https://yaml.org/spec/1.2/spec.html) there are some basic statements

    • Comments are a presentation detail and must not be used to convey content information.
    • Comments are not associated with a particular node.

    Having that in mind, the information in your sample has no meaning for the entry with the key performance_drivers_label as it is just to communicate between the human maintainers of the file. In Passolo the developers implemented a method to import the comments, but the comments are associated to the entries before the comment.

    Screenshot of YAML code with a comment indicating 'Don't translate this' next to the performance_drivers_label entry.

    Screenshot of Trados Studio interface showing the performance_drivers_label string with a comment 'P: Don't translate this'.

    To convert comments into meaningful actions your developers always must use a specific syntax within the comments (e.g. DNT for do not translate) and you must implement a macro to convert DNT in comments into read-only flags for the source list. This will help to achieve the first requirement.

    Pluralization in YAML

    Again reading the YAML specification will tell you that pluralization is an unknown concept in YAML and special escape characters like { or }, coming from Java placeholders and pluralization concepts doesn’t exist in YAML. All text in the value node becomes a translatable text without any special meaning. In Passolo you can use the Inline Pattern function to markup placeholders, but a complex and nested syntax like the Java pluralization can’t be handled using regular expressions from Inline Pattern. I assume that the pluralization used in your sample is coming from a special internationalization framework that uses YAML as the underlining persistence layer. There are various internationalization framework and all then might use non-YAML compliant user specific syntax elements to implement special features like pluralization. In Passolo we just support the basic YAML standard, and no additional internationalization frameworks. No specific checks are available for YAML, so you can use the Inline Pattern function or implement macro based checks to achieve your requirements.

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 5:43 AM (GMT 0) on 5 Mar 2024]
Reply
  • Comments in YAML

    When reading the YAML specification (https://yaml.org/spec/1.2/spec.html) there are some basic statements

    • Comments are a presentation detail and must not be used to convey content information.
    • Comments are not associated with a particular node.

    Having that in mind, the information in your sample has no meaning for the entry with the key performance_drivers_label as it is just to communicate between the human maintainers of the file. In Passolo the developers implemented a method to import the comments, but the comments are associated to the entries before the comment.

    Screenshot of YAML code with a comment indicating 'Don't translate this' next to the performance_drivers_label entry.

    Screenshot of Trados Studio interface showing the performance_drivers_label string with a comment 'P: Don't translate this'.

    To convert comments into meaningful actions your developers always must use a specific syntax within the comments (e.g. DNT for do not translate) and you must implement a macro to convert DNT in comments into read-only flags for the source list. This will help to achieve the first requirement.

    Pluralization in YAML

    Again reading the YAML specification will tell you that pluralization is an unknown concept in YAML and special escape characters like { or }, coming from Java placeholders and pluralization concepts doesn’t exist in YAML. All text in the value node becomes a translatable text without any special meaning. In Passolo you can use the Inline Pattern function to markup placeholders, but a complex and nested syntax like the Java pluralization can’t be handled using regular expressions from Inline Pattern. I assume that the pluralization used in your sample is coming from a special internationalization framework that uses YAML as the underlining persistence layer. There are various internationalization framework and all then might use non-YAML compliant user specific syntax elements to implement special features like pluralization. In Passolo we just support the basic YAML standard, and no additional internationalization frameworks. No specific checks are available for YAML, so you can use the Inline Pattern function or implement macro based checks to achieve your requirements.

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 5:43 AM (GMT 0) on 5 Mar 2024]
Children