SubtitleEdit / subtitleedit

the subtitle editor :)
http://www.nikse.dk/SubtitleEdit/Help
GNU General Public License v3.0
8.87k stars 916 forks source link

Bing Microsoft Translator API Key Isn't Recognized #8930

Open Ulmo2112 opened 1 month ago

Ulmo2112 commented 1 month ago

Thank you so much for such a beautiful and useful subtitles editor (the best Open Source) ! One issue regarding auto-translate though... I've set up a Microsoft Azure account with the Translator resource especially for this app. Then, in the options > Settings > Auto-Translate, I provided the credentials in the entries for "Microsoft Translator" on the right pane of the settings dialog window : the Key, an the default endpoint provided which is "https://api.cognitive.microsoft.com/sts/v1.0/issueToken". But when I start an auto- translation (the above key being the API key as expected), an error control box appears stating "API key is not valid!"

I tried again after changing the default endpoint to Azure's Web API text translation endpoint, which is "https://api.cognitive.microsofttranslator.com/"... Same result

I then tried again after changing the default endpoint to Azure's Web API document translation endpoint, which is "https://.cognitiveservices.azure.com/"... Same result

I then tried with the second Key (Azure provides 2 keys for that Translator resource), along the three different endpoints as above... Same result

Here is the full error message that I get: `API key is not valid!

{"error":{"code":401001,"message":"The request is not authorized because credentials are missing or invalid."}} à Nikse.SubtitleEdit.Core.AutoTranslate.MicrosoftTranslator.Translate(String text, String sourceLanguageCode, String targetLanguageCode, CancellationToken cancellationToken) à Nikse.SubtitleEdit.Forms.Translate.MergeAndSplitHelper.d__4.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() à Nikse.SubtitleEdit.Forms.Translate.AutoTranslate.d__33.MoveNext() [{ "Text":"HEART BEATING STEADILY. (etc.....)"}]`

Here's a screen capture of my Azure resource Keys and endpoints: Azure Keys and endpoints

niksedk commented 1 month ago

Works fine here:

image

image

image

image

Ulmo2112 commented 1 month ago

Thanks for your reply. Do you think that it could be a matter of location/region? I'm in Canada, and when registering the resource, if I select "global", Azure tells me that the resource isn't available for that location (hence the "canadacentral" location). I'll try again this week and do a followup here, thanks again.