Check whether batch/pre-translate mode or interactive/editor mode in a Translation Provider search

I was wondering if anyone can point me to something in the API that can be used to determine whether the current search calling SearchTranslationUnitsMasked() is a batch pre-translate operation or the result of a user navigating from segment to segment in the Editor.

I would like, among other things, to be able to handle errors differently depending on the two modes.  Also, related to another post by Sebastian Schleussner, it would be useful if you wanted to send all segments in a batch pre-translate over to an MT server at once, instead of one by one.

Parents Reply
  • Hi Agnes,

    What I've been doing has been to check the number of TUs sent in SearchTranslationUnitsMasked()...e.g. something like:

    bool isBatch = translationUnits.Length > 2;

    It seems that in batch mode the search method is called in groups of 10 or 11.  The 11th is normally a TU with a corresponding mask of False, representing the last TU of the previously-sent batch (presumably for context or something).  So, what I've found is that I can more or less detect if the search is batch if the number is greater than 2.

    This is sub-optimal for several reasons, but so far it has worked.  It would be nice if there were a publicly-exposed property in the API to indicate the mode, and possibly an event reporting the end of the lookup.  Anyway, for now I hope these suggestions help.

Children