• Not Answered

What is call in the Studio SDK to set the value of a custom TM attribute when saving to TM?

When the user does anything that results in saving a segment to TM, I want to intercept and set the values of custom fields on the translation unit before it is saved to TM.

How can I do that?

3 Replies Latest Replies: 19 Jun 2018 2:07 PM by Laurent Pierret

3 Replies

  • Hi Dan,

    Will the value for the custom field be the same for all segments in your document or will the value change for each segment?

    Regards,

    Laurent

  • In reply to Laurent Pierret:

    It could potentially be different for each segment.

  • In reply to Dan Higinbotham:

    Hi Dan,

    Well, it is quite tricky. Here are a couple of ideas, which need to be tested in order to be validated.

    One aspect to take into account is WHEN you want to update the fields:

    1. While translating

    Maybe you can use the Document.SegmentsConfirmationLevelChanged Event, which is triggered when the status of the segment changes. The only thing I do not know is whether the event is triggered before the segment is sent to the TM or after. This should be tested.

    If it is triggered before the segment pair is sent to the TM, you could call the project automation API to change the Field Values, which would then be applied when the segment pair is sent to the TM. If it is triggered after the pair is sent to the TM, I would suggest to look into another event, such Document.ActiveSegmentChanged Event and use the Project Automation API to change the field values at that moment.

    2. After translation

    With this, I mean when your document is completely translated and you want to update your main TM for example. Depending on the criteria you apply to set your field values, you might envisage a conversion of your SDLXLIFF into TMX and apply your field values for each TU in the TMX directly. But this solution is less "clean".

    As I said, these are just ideas but maybe you might find something useful to continue your development.

    Good luck!

    Laurent


Related