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
  • You have use the Bilingual API to add comments to an SDLXliff file. You can find an overview of the bilingual api here:  

    In essence you need to create an extension to the sdlxliff file type using FileTypeComponentBuilderExtension class. You can read more on how you can do that here. Also you can have a look at this plugin source code which is extending xliff file type.

    I've also written an article about how you can access segment tags using the file type framework which uses the exact mechanism as the one you need to implement for adding comments. You can read my article here:  

    The main objectives of the Integration API are to provide ability for the developers to create new views and view parts, extend the ribbon menu, create AutoSuggest providers and  ways to hook on main Studio views (projects, files, and editor). This API is more about extending the UI which was something very limited with the other API's

    Hope this helps.

Reply
  • You have use the Bilingual API to add comments to an SDLXliff file. You can find an overview of the bilingual api here:  

    In essence you need to create an extension to the sdlxliff file type using FileTypeComponentBuilderExtension class. You can read more on how you can do that here. Also you can have a look at this plugin source code which is extending xliff file type.

    I've also written an article about how you can access segment tags using the file type framework which uses the exact mechanism as the one you need to implement for adding comments. You can read my article here:  

    The main objectives of the Integration API are to provide ability for the developers to create new views and view parts, extend the ribbon menu, create AutoSuggest providers and  ways to hook on main Studio views (projects, files, and editor). This API is more about extending the UI which was something very limited with the other API's

    Hope this helps.

Children