Adding comments to segments

Hi,

I would like to add comments to paragraphunits in an existing sdlxliff document this way:

var pup = Controller.ActiveDocument.ActiveSegmentPair.GetParagraphUnitProperties();
pup.Comments = CreateComment(doc.PropertiesFactory, "abc", "xyz");

where

ICommentProperties CreateComment(IPropertiesFactory pf, string commentText, string origin)
{
var commentProperties = pf.CreateCommentProperties();
var comment = pf.CreateComment(commentText, origin, Sdl.FileTypeSupport.Framework.NativeApi.Severity.Low);
commentProperties.Add(comment);

return commentProperties;
}

But this does not seem to change the original segment. When I query the ParagraphUnitProperties again, the comments property is null again.

I also tried to reach the paragraphunit as ActiveSegmentPair.Target.ParentParagraphUnit, but it returns null.

Does anyone have an idea how to add comments (maybe also structure info) to existing segments?

Thanks,

Tamas

Parents Reply Children
  • This looks to be not possible with the integration API and to add to existing segments.
    I actually would like to get an official comment from SDL, but they seem to have designed the API to disallow any modification to the translation file in editor view. It would be nice if they commented on why they designed it like this, and whether they plan on making changes in the future.

    For example, the reason why your example code does not change the original segment, is because they `Clone()` deep copies of the segments internally. So, what you are working on is copies, and not the original objects.


    However, there does seem to be some possible to do things with the file types support framework, but that would be when preparing the translation file and not for existing document.