Integration API enhancements introduced in SDL Studio CU10
Latest SDL Studio update, cumulative update 10, was released on 13th of May and together with this update there a few additions to the integration API. If you want to see the entire list of changes included in this update have a look here. Now lets get down to business and talk about the integration api changes.
Table of contents
This is a pretty long post and you might not want to read through the entire article so if you want to read only a specific topic I prepared a jump-list with the topics I cover in this article:
- Segment translation on-demand
- Active file properties
- Access/update segment and paragraph unit properties
- CRUD operations on comments
- Change segment confirmation level
- AutoSuggest provider icon
- Segment Content ready
Segment translation on-demand
Segment translation is done by the translation providers that are configured and enabled at the project level. This can happen as a pre-translation step or when the current segment is changed by the user in the user interface. With this new feature added to the integration API a developer is able to request the translation of the current selected segment whenever this is needed. This can be done from the EditorController. To see this in action you can look at this sample:
This sample code is take from the Controlled Machine Translation Providers plugin.
Active file properties
Until now developers were only able to get information about ActiveFile like statistics, language, project id and so on. There was no way to get information like creation date, change date, metada and so on. This is now possible using ActiveFileProperties property of the Document class. Also an event was added to notify when the active file properties are changed.
Access/update segment and paragraph unit properties
Update 23.09.2015 - This feature didn't make it in Studio 2014 CU10 and it's available only in Studio 2015
If you needed to make any work around segments the only available option was to use ProcessSegmentPairs method from the Document class. Now this can do the trick but it's not straightforward to use and can be an overhead for simple scenarios, also this method was not providing any way to interact with paragraph units. We've now added a couple other options that provide more granularity and flexibility in how a developer is able to process segments. We also added capabilities to work directly with paragraph units. Here's the list with the methods available:
- GetSegmentPairsFromParagraph - Based on the paragraph id you can obtain the segment pairs of that paragraph
- UpdateSegmentPair - updates the document with the specified segment pair
- UpdateSegmentPairProperties - updates the document with the specified segment pair properties
- UpdateParagraphProperties - updates the document with the specified paragraph properties
CRUD operations on comments
Adding comments was only possible using Billingual API. While this is fine when you want to do it for your custom file type is not productive to use it when you just want to add comments to your well known file type. To solve this issue the integration api has now specialized methods that allow CRUD operations for comments. Here's the list with the methods available:
- AddCommentOnSegment
- UpdateCommentOnSegment
- DeleteCommentOnSegment
- DeleteAllCommentsOnSegment
Change segment confirmation level
Developers are now able to change the segment confirmation level using the integration API and also they can now subscribe to an event that is trigger when the confirmation level is changed.
AutoSuggest provider icon
Developer can now add custom icons for their AutoSuggest providers.
Segment Content ready
There are situations where you may want to do some additional work after the translation has been done. To cover this type of situation the event ActiveSegmentContentIsReady was added to the Document class.
Please leave a comment if you have any questions.