SDL Studio 2019 & 2021: MT Enhanced with Microsoft Azure key not working.

Dear SDL Devs and community,

we tried to install the mt enhanced plugin on a new installation of Studio 2019 and 2021. It seems that there was a chance in the Azure API regarding HTTP headers. We followed the installation instructions on:

https://community.sdl.com/product-groups/translationproductivity/w/customer-experience/1271/microsoft-translator-credentials-for-mt-enhanced-app

We are using the key in other software without problems, so the problem seems to be in the mt enhanced plugin

Studio Versions:

15.2.8.3007

16.1.3.4096

Plugin Versions:

4.3.12

5.3.12

Exception occuring in SDL logs (german system language) besides a 401 (unauthorized) warning in the Studio 2021 UI:

ERROR [2021-02-05 11:15:19,634] Sdl.TranslationStudio.Editor.Translation.TranslationMemorySegmentSearch - Das Format des Werts "<null>" ist ungültig.
System.FormatException: Das Format des Werts "<null>" ist ungültig.
bei System.Net.Http.Headers.HttpHeaderParser.ParseValue(String value, Object storeValue, Int32& index)
bei System.Net.Http.Headers.HttpHeaders.ParseAndAddValue(String name, HeaderStoreItemInfo info, String value)
bei System.Net.Http.Headers.HttpHeaders.Add(String name, String value)
bei Sdl.Community.MtEnhancedProvider.MstConnect.ApiConnecter.Translate(String sourceLang, String targetLang, String textToTranslate, String categoryId, String format)
bei Sdl.Community.MtEnhancedProvider.MtTranslationProviderLanguageDirection.LookupMst(String sourcetext, MtTranslationOptions options, String format)
bei Sdl.Community.MtEnhancedProvider.MtTranslationProviderLanguageDirection.SearchSegment(SearchSettings settings, Segment segment)
bei Sdl.Community.MtEnhancedProvider.MtTranslationProviderLanguageDirection.SearchTranslationUnit(SearchSettings settings, TranslationUnit translationUnit)
bei Sdl.Community.MtEnhancedProvider.MtTranslationProviderLanguageDirection.SearchTranslationUnitsMasked(SearchSettings settings, TranslationUnit[] translationUnits, Boolean[] mask)
bei Sdl.LanguagePlatform.TranslationMemoryApi.Cascade`1.SearchSegmentAndSubSegmentTranslationUnitsMaskedCommand.Execute(T cascadeEntry, SearchSettings searchSettings)
bei Sdl.LanguagePlatform.TranslationMemoryApi.Cascade`1.ExecuteSearchCommand(SearchCommand`1 searchCommand, SearchSettings searchSettings, Int32 searchResultsCount, IEnumerable`1& cascadeMessages)

Parents
  • Hi ,

    I have tested here locally + on a clean vm installation (plugin version 5.3.12, against Studio version 16.1.4), but unable to reproduce the issue that you have reported here.

    Please try the following and reconfirm on your side:

    • Test without any other plugins loaded in Studio to exclude any external influences (e.g. unknowns)
    • Test against Studio 2021 sr1 cu4?

    Dev Notes (for internal reference):
    Reviewing the code just now, I have seen that we are referencing RestSharp (RestClient) with this plugin; we will need to plan a development cycle to remove this (for future releases), as we have seen unsupported issues directly related to this assembly in the past; to be substituted with standard http client implementation

  • Hi ,


    we tested again with Studio 16.1.4.4184 and MT enhanced 5.3.12 freshly setup, no other plugins installed. Unfortunately we still get a 

    Der Antwortstatuscode gibt keinen Erfolg an: 401 (Access Denied). 

    through the UI (of the MT enhanced plugin when configuring it within a project template) and the following logs in the Studio Client. I double checked our Azure MT API key, which works fine when using Postman, see attached image.



    INFO [2021-03-30 14:55:51,369] Studio - Starting application service.
    INFO [2021-03-30 14:55:51,932] StudioInstanceDiscovery - Registered object into running object table: 65536
    INFO [2021-03-30 14:55:56,119] IProjectManagementService - ProjectManagementService started: 567ms
    INFO [2021-03-30 14:55:59,963] Sdl.TranslationStudio.Editor.Terminology.TermAccessProvider - the number of calls to the server = 0
    INFO [2021-03-30 14:56:07,010] WalkMeContentProvider - Tips could not be found at location Tips.xml
    INFO [2021-03-30 14:56:11,107] Job - Start#Id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx#Name=Verbindungsaufbau#ProcessName=SDLTradosStudio#PhysicalMemorySize=202297344#VirtualMemorySize=120696832#ThreadCount=39#HandleCount=1435#GdiHandleCount=870#UserHandleCount=410#TotalProcessorTime=00:00:16.8437500
    INFO [2021-03-30 14:56:11,122] Job - Finish#Id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx#Name=Verbindungsaufbau#ProcessName=SDLTradosStudio#PhysicalMemorySize=202391552#VirtualMemorySize=120709120#ThreadCount=39#HandleCount=1440#GdiHandleCount=870#UserHandleCount=409#TotalProcessorTime=00:00:16.8750000
    INFO [2021-03-30 14:56:11,763] AppStoreIntegration - Request with trace id xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx for studio-appstore-api.azurewebsites.net/plugins Trados Studio 2021:
    INFO [2021-03-30 14:56:11,794] Sdl.BestMatchService.Common.Client.RemoteUserServiceClient - Request with trace id xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx for sdl-prod.eu.auth0.com/.../revoke:
    INFO [2021-03-30 14:56:11,857] AppStoreIntegration - Request response: OK
    INFO [2021-03-30 14:56:11,904] Sdl.BestMatchService.Common.Client.RemoteUserServiceClient - Request response: BadRequest
    ERROR [2021-03-30 14:56:11,904] Sdl.BestMatchService.Common.Client.RemoteUserServiceClient - Trace_id trace_id not available: RequestUri: sdl-prod.eu.auth0.com/.../revoke, ReasonPhrase: Bad Request
    ERROR [2021-03-30 14:56:11,920] Sdl.BestMatchServiceStudioIntegration.Common.Account.Model.LanguageCloudCredential - Sdl.BestMatchService.Common.Exceptions.LanguageCloudException: Verbindung zu Language Cloud fehlgeschlagen.
    bei Sdl.BestMatchService.Common.AbstractApiClient.HandleError(HttpResponseMessage response)
    bei Sdl.BestMatchService.Common.Client.RemoteUserServiceClient.RevokeRefreshToken()
    bei Sdl.BestMatchServiceStudioIntegration.Common.Account.Model.LanguageCloudCredential.Logout()
    INFO [2021-03-30 14:56:12,029] AppStoreIntegration - Request with trace id xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx for oos.sdl.com/.../Apps Enhanced Plugin for Trados Studio') and Versions/any(v:v/SupportedProducts/any(sp:sp/ProductName eq 'SDL Trados Studio 2021'))&$count=true&$top=10:
    INFO [2021-03-30 14:56:12,091] Sdl.Desktop.Platform.Implementation.Services.UpdateService - Started TrueUpdate Process Id: 12244
    INFO [2021-03-30 14:56:12,138] AppStoreIntegration - Request response: OK
    INFO [2021-03-30 14:56:14,201] Sdl.Desktop.Platform.Implementation.Services.UpdateService - TrueUpdate Process Id: 12244has exited
    INFO [2021-03-30 14:56:14,201] Sdl.Desktop.Platform.Implementation.Services.UpdateService - Trying to read file:C:\Users\ANONYMOUS\AppData\Local\Temp\Studio16Updates\FilteredUpdates.xml
    INFO [2021-03-30 14:56:14,201] Sdl.Desktop.Platform.Implementation.Services.UpdateService - File not found
    INFO [2021-03-30 14:56:14,873] ActionService - Start#Id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx#Name=options#ProcessName=SDLTradosStudio#PhysicalMemorySize=245391360#VirtualMemorySize=145059840#ThreadCount=46#HandleCount=1588#GdiHandleCount=862#UserHandleCount=384#TotalProcessorTime=00:00:20.4375000
    INFO [2021-03-30 14:56:34,258] ActionService - Finish#Id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx#Name=options#ProcessName=SDLTradosStudio#PhysicalMemorySize=266178560#VirtualMemorySize=153370624#ThreadCount=45#HandleCount=1633#GdiHandleCount=919#UserHandleCount=409#TotalProcessorTime=00:00:23.5156250
    INFO [2021-03-30 14:56:37,055] ActionService - Start#Id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx#Name=viewlogfileaction#ProcessName=SDLTradosStudio#PhysicalMemorySize=266260480#VirtualMemorySize=153440256#ThreadCount=44#HandleCount=1630#GdiHandleCount=919#UserHandleCount=411#TotalProcessorTime=00:00:23.9687500
    INFO [2021-03-30 14:56:37,117] ActionService - Finish#Id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx#Name=viewlogfileaction#ProcessName=SDLTradosStudio#PhysicalMemorySize=266747904#VirtualMemorySize=153587712#ThreadCount=44#HandleCount=1658#GdiHandleCount=919#UserHandleCount=413#TotalProcessorTime=00:00:24.0312500
    INFO [2021-03-30 15:05:39,350] ActionService - Start#Id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx#Name=LanguageCloudLoginAction#ProcessName=SDLTradosStudio#PhysicalMemorySize=266452992#VirtualMemorySize=152723456#ThreadCount=32#HandleCount=1642#GdiHandleCount=919#UserHandleCount=404#TotalProcessorTime=00:00:24.1562500
    INFO [2021-03-30 15:05:43,725] ActionService - Finish#Id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx#Name=LanguageCloudLoginAction#ProcessName=SDLTradosStudio#PhysicalMemorySize=299782144#VirtualMemorySize=178573312#ThreadCount=35#HandleCount=1738#GdiHandleCount=929#UserHandleCount=425#TotalProcessorTime=00:00:25.2812500
    INFO [2021-03-30 15:05:48,475] ActionService - Start#Id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx#Name=ManageProjectTemplatesAction#ProcessName=SDLTradosStudio#PhysicalMemorySize=299810816#VirtualMemorySize=178827264#ThreadCount=41#HandleCount=1729#GdiHandleCount=929#UserHandleCount=419#TotalProcessorTime=00:00:25.5937500
    INFO [2021-03-30 15:19:30,764] ActionService - Finish#Id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx#Name=ManageProjectTemplatesAction#ProcessName=SDLTradosStudio#PhysicalMemorySize=367243264#VirtualMemorySize=219209728#ThreadCount=38#HandleCount=1784#GdiHandleCount=969#UserHandleCount=435#TotalProcessorTime=00:00:31.6718750
    INFO [2021-03-30 15:29:49,114] ActionService - Start#Id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx#Name=options#ProcessName=SDLTradosStudio#PhysicalMemorySize=366026752#VirtualMemorySize=219209728#ThreadCount=35#HandleCount=1752#GdiHandleCount=967#UserHandleCount=435#TotalProcessorTime=00:00:32.1718750
    INFO [2021-03-30 15:30:01,214] ActionService - Finish#Id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx#Name=options#ProcessName=SDLTradosStudio#PhysicalMemorySize=372154368#VirtualMemorySize=220864512#ThreadCount=40#HandleCount=1799#GdiHandleCount=1040#UserHandleCount=460#TotalProcessorTime=00:00:33.2031250
    INFO [2021-03-30 15:30:03,730] ActionService - Start#Id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx#Name=viewlogfileaction#ProcessName=SDLTradosStudio#PhysicalMemorySize=369659904#VirtualMemorySize=220966912#ThreadCount=40#HandleCount=1801#GdiHandleCount=1040#UserHandleCount=461#TotalProcessorTime=00:00:33.3750000
    INFO [2021-03-30 15:30:03,792] ActionService - Finish#Id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx#Name=viewlogfileaction#ProcessName=SDLTradosStudio#PhysicalMemorySize=369680384#VirtualMemorySize=220966912#ThreadCount=40#HandleCount=1804#GdiHandleCount=1040#UserHandleCount=463#TotalProcessorTime=00:00:33.4375000

    Screenshot of Postman interface showing a successful API call to Azure MT with a JSON response body containing the text 'Hello, world!'



    Generated Image Alt-Text
    [edited by: Trados AI at 1:26 PM (GMT 0) on 5 Mar 2024]
  • Hi & team,

    I think you are right on the mark with this... it seems that the provider doesn't cater for authenticating the credentials against a specific region.  I will followup with your suggestions and potentially expose an option where the user can specify the region specific header key

  • Hi & team,

    Note: This should be released within the next week once it passes our internal QA procedures;  will followup

    All changes included with the latest release:

    • Version 5.3.13.3 - supports Studio 2021 SR1

    Overview

    Until now we have hard-coded the URI that is used to authorize the user given a subscription key.  We have changed this to align with the latest release of the Microsoft Translator API so the correct URI is referenced with the HTTP client.  The URI can be different given the specific region that is associated with the subscription.

    Updates

    • Introduced a new option that is available from the provider settings enabling the user to specify the subscription region (if required).
    • Updated the API Connector service to compile a valid URI, that is used to request the authorization token, given a specific region.
    • Updated the providers factory to locate the credential from the credential store if derived from the Automation API

    Provider Settings

    Trados Studio MT Enhanced settings window showing dropdown for selecting Microsoft Translator as MT Provider, field for entering Microsoft Translate API Key, checkbox to save key, dropdown for Subscription Region set to West Europe, and unchecked 'Use Category Id' option.

    Code Example: demonstrates how to add the provider from the Project Automation API

    var templateReference = new ProjectTemplateReference(projectTemplateFile);
    var project = new FileBasedProject(projectInfo, templateReference);
    
    var region = "westeurope";
    var uri_scheme = "mtenhancedprovider:///";
    var uri_provider = "Microsoft+Translator";
    var uri = new Uri($"{uri_scheme}?selectedprovider={uri_provider}&region={region}");
    			
    var tmConfig = project.GetTranslationProviderConfiguration();
    var provider = new TranslationProviderReference(uri, string.Empty, true);
    var entry = new TranslationProviderCascadeEntry(provider, false, true, true, 0);
    tmConfig.Entries.Add(entry);
    
    project.UpdateTranslationProviderConfiguration(tmConfig);
    
    var apiKey = "<api_key>";
    project.Credentials.AddCredential(new Uri(uri_scheme), apiKey);
    
    project.Save();


    Generated Image Alt-Text
    [edited by: Trados AI at 1:26 PM (GMT 0) on 5 Mar 2024]
Reply
  • Hi & team,

    Note: This should be released within the next week once it passes our internal QA procedures;  will followup

    All changes included with the latest release:

    • Version 5.3.13.3 - supports Studio 2021 SR1

    Overview

    Until now we have hard-coded the URI that is used to authorize the user given a subscription key.  We have changed this to align with the latest release of the Microsoft Translator API so the correct URI is referenced with the HTTP client.  The URI can be different given the specific region that is associated with the subscription.

    Updates

    • Introduced a new option that is available from the provider settings enabling the user to specify the subscription region (if required).
    • Updated the API Connector service to compile a valid URI, that is used to request the authorization token, given a specific region.
    • Updated the providers factory to locate the credential from the credential store if derived from the Automation API

    Provider Settings

    Trados Studio MT Enhanced settings window showing dropdown for selecting Microsoft Translator as MT Provider, field for entering Microsoft Translate API Key, checkbox to save key, dropdown for Subscription Region set to West Europe, and unchecked 'Use Category Id' option.

    Code Example: demonstrates how to add the provider from the Project Automation API

    var templateReference = new ProjectTemplateReference(projectTemplateFile);
    var project = new FileBasedProject(projectInfo, templateReference);
    
    var region = "westeurope";
    var uri_scheme = "mtenhancedprovider:///";
    var uri_provider = "Microsoft+Translator";
    var uri = new Uri($"{uri_scheme}?selectedprovider={uri_provider}&region={region}");
    			
    var tmConfig = project.GetTranslationProviderConfiguration();
    var provider = new TranslationProviderReference(uri, string.Empty, true);
    var entry = new TranslationProviderCascadeEntry(provider, false, true, true, 0);
    tmConfig.Entries.Add(entry);
    
    project.UpdateTranslationProviderConfiguration(tmConfig);
    
    var apiKey = "<api_key>";
    project.Credentials.AddCredential(new Uri(uri_scheme), apiKey);
    
    project.Save();


    Generated Image Alt-Text
    [edited by: Trados AI at 1:26 PM (GMT 0) on 5 Mar 2024]
Children
No Data