Calling TM Providers via the API

Hi,

We have two questions related to the use of TM Providers in Trados Studio:

  1. Is it possible to download via API only information about plugins that are of the "TMs engine plugin" type that can be used in the translation resource (as in the screenshot)? We would like to download a list of tms engine plugins installed in trados. Is there any special method for this? If not, then how can we determine if a given plugin is of the "TMs engine" type? The method IPluginRegistry DefaultPluginRegistry returns all installed plugins, unfortunately it does not specify the type, e.g. TMS engine


  2. How should we use the API, that the project uses a given TM engine? Should we use fileBasedProject.UpdateTranslationProviderConfiguration?

Top Replies

  •  

    For some reason I cannot add links to the documentation in the comments so I'll just have to point you to what to search on google:

    1. TranslationProviderManager.GetTranslationProviderFactories…

Parents
  • Hi ,

    Is it possible to download via API only information about plugins that are of the "TMs engine plugin" type that can be used in the translation resource (as in the screenshot)? We would like to download a list of tms engine plugins installed in trados. Is there any special method for this? If not, then how can we determine if a given plugin is of the "TMs engine" type? The method IPluginRegistry DefaultPluginRegistry returns all installed plugins, unfortunately it does not specify the type, e.g. TMS engine

    It is possible to get a list of extensions from the plugin manager by attribute type (e.g. TranslationProviderFactoryAttribute) and validate whether it supports a uri scheme and/or host:

    Example:

    var extensionPoint = PluginManager.DefaultPluginRegistry.GetExtensionPoint<TranslationProviderFactoryAttribute>();
    if (extensionPoint == null)
    {
    	return;
    }
    foreach (var extension in extensionPoint.Extensions)
    {
    	// 1. identify if the provider is enabled
    	if (!extension.Enabled)
    	{
    		continue;
    	}
    
    	// 2. identify if the extension is a provider of interest to you
    	// from here you can identify the type
    	// extension.ExtensionType == etc..
    	// extension.Plugin.Id == etc...
    
    	// 3. create an instance of the providers factory
    	var factory = (ITranslationProviderFactory)extension.CreateInstance();
    	if (factory == null)
    	{
    		continue;
    	}
    
    	// 4. check if a specific uri is supported by the provider
    	var supported = factory.SupportsTranslationProviderUri(new Uri("scheme://my.domain.com"));
    }    


    How should we use the API, that the project uses a given TM engine? Should we use fileBasedProject.UpdateTranslationProviderConfiguration?

    Yes, correct, please make reference to the example from 

  • Hi

    Thank you for all your previous help, it was a big push forward.
    At this stage we implement the method you advised:

    PluginManager.DefaultPluginRegistry.GetExtensionPoint<TranslationProviderFactoryAttribute>()

    However we notice that the response varies from Trados 16.1.4.4184 and 16.1.6.4276.


    In 16.1.4 we receive plugins both built-in and installed and in 16.1.6 we receive only built-in.
    It is a little problematic for us at this stage, could you please advise how we can also get the installed plugins in newer version?

    Kind Regards,

    Tomasz

Reply
  • Hi

    Thank you for all your previous help, it was a big push forward.
    At this stage we implement the method you advised:

    PluginManager.DefaultPluginRegistry.GetExtensionPoint<TranslationProviderFactoryAttribute>()

    However we notice that the response varies from Trados 16.1.4.4184 and 16.1.6.4276.


    In 16.1.4 we receive plugins both built-in and installed and in 16.1.6 we receive only built-in.
    It is a little problematic for us at this stage, could you please advise how we can also get the installed plugins in newer version?

    Kind Regards,

    Tomasz

Children